module.exports = (function() { var __MODS__ = {}; var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; }; var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; __DEFINE__(1745998156462, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkUpdate = exports.M = exports.parseInjects = exports.parseUniExtApis = void 0; __exportStar(require("./fs"), exports); __exportStar(require("./mp"), exports); __exportStar(require("./url"), exports); __exportStar(require("./env"), exports); __exportStar(require("./hbx"), exports); __exportStar(require("./ssr"), exports); __exportStar(require("./vue"), exports); __exportStar(require("./uts"), exports); __exportStar(require("./logs"), exports); __exportStar(require("./i18n"), exports); __exportStar(require("./deps"), exports); __exportStar(require("./json"), exports); __exportStar(require("./vite"), exports); __exportStar(require("./utils"), exports); __exportStar(require("./easycom"), exports); __exportStar(require("./constants"), exports); __exportStar(require("./preprocess"), exports); __exportStar(require("./postcss"), exports); __exportStar(require("./filter"), exports); __exportStar(require("./esbuild"), exports); __exportStar(require("./resolve"), exports); __exportStar(require("./scripts"), exports); __exportStar(require("./platform"), exports); var uni_modules_1 = require("./uni_modules"); Object.defineProperty(exports, "parseUniExtApis", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApis; } }); Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function () { return uni_modules_1.parseInjects; } }); var messages_1 = require("./messages"); Object.defineProperty(exports, "M", { enumerable: true, get: function () { return messages_1.M; } }); __exportStar(require("./exports"), exports); // @ts-ignore var checkUpdate_1 = require("./checkUpdate"); Object.defineProperty(exports, "checkUpdate", { enumerable: true, get: function () { return checkUpdate_1.checkUpdate; } }); }, function(modId) {var map = {"./fs":1745998156463,"./mp":1745998156464,"./url":1745998156499,"./env":1745998156500,"./hbx":1745998156551,"./ssr":1745998156558,"./vue":1745998156559,"./uts":1745998156575,"./logs":1745998156473,"./i18n":1745998156541,"./deps":1745998156578,"./json":1745998156506,"./vite":1745998156579,"./easycom":1745998156597,"./constants":1745998156488,"./preprocess":1745998156481,"./postcss":1745998156600,"./filter":1745998156603,"./esbuild":1745998156604,"./resolve":1745998156503,"./platform":1745998156606,"./messages":1745998156485,"./exports":1745998156608,"./checkUpdate":1745998156609}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156463, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.emptyDir = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); function emptyDir(dir, skip = []) { for (const file of fs_1.default.readdirSync(dir)) { if (skip.includes(file)) { continue; } // node >= 14.14.0 fs_1.default.rmSync(path_1.default.resolve(dir, file), { recursive: true, force: true }); } } exports.emptyDir = emptyDir; }, function(modId) { var map = {"fs":1745998156463}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156464, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.parseExternalClasses = exports.hasExternalClasses = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.transformDynamicImports = exports.parseTemplateDescriptor = exports.parseScriptDescriptor = exports.parseMainDescriptor = exports.copyMiniProgramThemeJson = exports.copyMiniProgramPluginJson = exports.HTML_TO_MINI_PROGRAM_TAGS = void 0; __exportStar(require("./ast"), exports); __exportStar(require("./wxs"), exports); __exportStar(require("./nvue"), exports); __exportStar(require("./event"), exports); __exportStar(require("./style"), exports); __exportStar(require("./assets"), exports); __exportStar(require("./template"), exports); __exportStar(require("./constants"), exports); var tags_1 = require("./tags"); Object.defineProperty(exports, "HTML_TO_MINI_PROGRAM_TAGS", { enumerable: true, get: function () { return tags_1.HTML_TO_MINI_PROGRAM_TAGS; } }); var plugin_1 = require("./plugin"); Object.defineProperty(exports, "copyMiniProgramPluginJson", { enumerable: true, get: function () { return plugin_1.copyMiniProgramPluginJson; } }); Object.defineProperty(exports, "copyMiniProgramThemeJson", { enumerable: true, get: function () { return plugin_1.copyMiniProgramThemeJson; } }); var usingComponents_1 = require("./usingComponents"); Object.defineProperty(exports, "parseMainDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseMainDescriptor; } }); Object.defineProperty(exports, "parseScriptDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseScriptDescriptor; } }); Object.defineProperty(exports, "parseTemplateDescriptor", { enumerable: true, get: function () { return usingComponents_1.parseTemplateDescriptor; } }); Object.defineProperty(exports, "transformDynamicImports", { enumerable: true, get: function () { return usingComponents_1.transformDynamicImports; } }); Object.defineProperty(exports, "updateMiniProgramGlobalComponents", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramGlobalComponents; } }); Object.defineProperty(exports, "updateMiniProgramComponentsByMainFilename", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramComponentsByMainFilename; } }); Object.defineProperty(exports, "updateMiniProgramComponentsByScriptFilename", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramComponentsByScriptFilename; } }); Object.defineProperty(exports, "updateMiniProgramComponentsByTemplateFilename", { enumerable: true, get: function () { return usingComponents_1.updateMiniProgramComponentsByTemplateFilename; } }); var externalClasses_1 = require("./externalClasses"); Object.defineProperty(exports, "hasExternalClasses", { enumerable: true, get: function () { return externalClasses_1.hasExternalClasses; } }); Object.defineProperty(exports, "parseExternalClasses", { enumerable: true, get: function () { return externalClasses_1.parseExternalClasses; } }); Object.defineProperty(exports, "findMiniProgramComponentExternalClasses", { enumerable: true, get: function () { return externalClasses_1.findMiniProgramComponentExternalClasses; } }); Object.defineProperty(exports, "updateMiniProgramComponentExternalClasses", { enumerable: true, get: function () { return externalClasses_1.updateMiniProgramComponentExternalClasses; } }); }, function(modId) { var map = {"./ast":1745998156465,"./wxs":1745998156467,"./nvue":1745998156468,"./event":1745998156470,"./style":1745998156471,"./assets":1745998156475,"./template":1745998156476,"./constants":1745998156478,"./tags":1745998156472,"./plugin":1745998156479,"./usingComponents":1745998156484,"./externalClasses":1745998156498}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156465, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseProgram = void 0; const parser_1 = require("@babel/parser"); const utils_1 = require("../utils"); function parseProgram(code, importer, { babelParserPlugins }) { return (0, parser_1.parse)(code, { plugins: (0, utils_1.normalizeParsePlugins)(importer, babelParserPlugins), sourceType: 'module', }).program; } exports.parseProgram = parseProgram; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156467, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.genWxsCallMethodsCode = exports.parseWxsCallMethods = void 0; const types_1 = require("@babel/types"); const estree_walker_1 = require("estree-walker"); const ast_1 = require("./ast"); function parseWxsCallMethods(code) { if (!code.includes('callMethod')) { return []; } const ast = (0, ast_1.parseProgram)(code, '', {}); const wxsCallMethods = new Set(); estree_walker_1.walk(ast, { enter(child) { if (!(0, types_1.isCallExpression)(child)) { return; } const { callee } = child; // .callMethod if (!(0, types_1.isMemberExpression)(callee) || !(0, types_1.isIdentifier)(callee.property) || callee.property.name !== 'callMethod') { return; } // .callMethod('test',...) const args = child.arguments; if (!args.length) { return; } const [name] = args; if (!(0, types_1.isStringLiteral)(name)) { return; } wxsCallMethods.add(name.value); }, }); return [...wxsCallMethods]; } exports.parseWxsCallMethods = parseWxsCallMethods; function genWxsCallMethodsCode(code) { const wxsCallMethods = parseWxsCallMethods(code); if (!wxsCallMethods.length) { return `export default {}`; } return `export default (Component) => { if(!Component.wxsCallMethods){ Component.wxsCallMethods = [] } Component.wxsCallMethods.push(${wxsCallMethods .map((m) => `'${m}'`) .join(', ')}) } `; } exports.genWxsCallMethodsCode = genWxsCallMethodsCode; }, function(modId) { var map = {"./ast":1745998156465}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156468, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.genNVueCssCode = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const nvue_1 = require("../json/app/manifest/nvue"); function genNVueCssCode(manifestJson) { let nvueCssCode = fs_1.default.readFileSync(path_1.default.resolve(__dirname, '../../lib/nvue.css'), 'utf8'); const flexDirection = (0, nvue_1.getNVueFlexDirection)(manifestJson); if (flexDirection !== 'column') { nvueCssCode = nvueCssCode.replace('column', flexDirection); } return nvueCssCode; } exports.genNVueCssCode = genNVueCssCode; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156470, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.formatMiniProgramEvent = void 0; const uni_shared_1 = require("@dcloudio/uni-shared"); function formatMiniProgramEvent(eventName, { isCatch, isCapture, isComponent, }) { if (isComponent) { // 自定义组件的自定义事件需要格式化,因为 triggerEvent 时也会格式化 eventName = (0, uni_shared_1.customizeEvent)(eventName); } if (!isComponent && eventName === 'click') { eventName = 'tap'; } let eventType = 'bind'; if (isCatch) { eventType = 'catch'; } if (isCapture) { return `capture-${eventType}:${eventName}`; } // bind:foo-bar return eventType + (isSimpleExpr(eventName) ? '' : ':') + eventName; } exports.formatMiniProgramEvent = formatMiniProgramEvent; function isSimpleExpr(name) { if (name.startsWith('_')) { return false; } if (name.indexOf('-') > -1) { return false; } if (name.indexOf(':') > -1) { return false; } return true; } }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156471, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.transformScopedCss = void 0; const tags_1 = require("./tags"); const logs_1 = require("../logs"); function transformScopedCss(cssCode) { checkHtmlTagSelector(cssCode); return cssCode.replace(/\[(data-v-[a-f0-9]{8})\]/gi, (_, scopedId) => { return '.' + scopedId; }); } exports.transformScopedCss = transformScopedCss; function checkHtmlTagSelector(cssCode) { for (const tag in tags_1.HTML_TO_MINI_PROGRAM_TAGS) { if (new RegExp(`( |\n|\t|,|})${tag}( *)(,|{)`, 'g').test(cssCode)) { (0, logs_1.output)('warn', `小程序端 style 暂不支持 ${tag} 标签选择器,推荐使用 class 选择器,详情参考:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#style`); break; } } } }, function(modId) { var map = {"./tags":1745998156472,"../logs":1745998156473}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156472, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.HTML_TO_MINI_PROGRAM_TAGS = void 0; exports.HTML_TO_MINI_PROGRAM_TAGS = { br: 'view', hr: 'view', p: 'view', h1: 'view', h2: 'view', h3: 'view', h4: 'view', h5: 'view', h6: 'view', abbr: 'view', address: 'view', b: 'view', bdi: 'view', bdo: 'view', blockquote: 'view', cite: 'view', code: 'view', del: 'view', ins: 'view', dfn: 'view', em: 'view', strong: 'view', samp: 'view', kbd: 'view', var: 'view', i: 'view', mark: 'view', pre: 'view', q: 'view', ruby: 'view', rp: 'view', rt: 'view', s: 'view', small: 'view', sub: 'view', sup: 'view', time: 'view', u: 'view', wbr: 'view', // 表单元素 // form: 'form', // input: 'input', // textarea: 'textarea', // button: 'button', select: 'picker', option: 'view', optgroup: 'view', // label: 'label', fieldset: 'view', datalist: 'picker', legend: 'view', output: 'view', // 框架 iframe: 'view', // 图像 img: 'image', // canvas: 'canvas', figure: 'view', figcaption: 'view', // 音视频 // audio: 'audio', source: 'audio', // video: 'video', track: 'video', // 链接 a: 'navigator', nav: 'view', link: 'navigator', // 列表 ul: 'view', ol: 'view', li: 'view', dl: 'view', dt: 'view', dd: 'view', menu: 'view', command: 'view', // 表格table table: 'view', caption: 'view', th: 'view', td: 'view', tr: 'view', thead: 'view', tbody: 'view', tfoot: 'view', col: 'view', colgroup: 'view', // 样式 节 div: 'view', main: 'view', span: 'label', header: 'view', footer: 'view', section: 'view', article: 'view', aside: 'view', details: 'view', dialog: 'view', summary: 'view', // progress: 'progress', meter: 'progress', head: 'view', meta: 'view', base: 'text', // 'map': 'image', // TODO不是很恰当 area: 'navigator', script: 'view', noscript: 'view', embed: 'view', object: 'view', param: 'view', }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156473, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.output = exports.formatWarnMsg = exports.formatInfoMsg = exports.formatErrMsg = void 0; var format_1 = require("./format"); Object.defineProperty(exports, "formatErrMsg", { enumerable: true, get: function () { return format_1.formatErrMsg; } }); Object.defineProperty(exports, "formatInfoMsg", { enumerable: true, get: function () { return format_1.formatInfoMsg; } }); Object.defineProperty(exports, "formatWarnMsg", { enumerable: true, get: function () { return format_1.formatWarnMsg; } }); let lastType; let lastMsg; function output(type, msg) { if (type === lastType && msg === lastMsg) { return; } lastMsg = msg; lastType = type; const method = type === 'info' ? 'log' : type; console[method](msg); } exports.output = output; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156475, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isMiniProgramAssetFile = void 0; const path_1 = __importDefault(require("path")); const EXTNAMES = [ '.png', '.jpg', '.jpeg', '.gif', '.svg', '.json', '.cer', '.mp3', '.aac', '.m4a', '.mp4', '.wav', '.ogg', '.silk', '.wasm', '.br', '.cert', ]; function isMiniProgramAssetFile(filename) { if (!path_1.default.isAbsolute(filename)) { return false; } return EXTNAMES.includes(path_1.default.extname(filename)); } exports.isMiniProgramAssetFile = isMiniProgramAssetFile; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156476, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.addMiniProgramTemplateFilter = exports.clearMiniProgramTemplateFilter = exports.addMiniProgramTemplateFile = exports.clearMiniProgramTemplateFiles = exports.findMiniProgramTemplateFiles = void 0; const path_1 = __importDefault(require("path")); const uni_shared_1 = require("@dcloudio/uni-shared"); const utils_1 = require("../utils"); const templateFilesCache = new Map(); const templateFiltersCache = new Map(); function relativeFilterFilename(filename, filter) { if (!filter.src) { return ''; } return ('./' + (0, utils_1.normalizeMiniProgramFilename)(path_1.default.relative(path_1.default.dirname(filename), filter.src))); } function findMiniProgramTemplateFiles(genFilter) { const files = Object.create(null); templateFilesCache.forEach((code, filename) => { if (!genFilter) { files[filename] = code; } else { const filters = getMiniProgramTemplateFilters(filename); if (filters && filters.length) { files[filename] = filters .map((filter) => genFilter(filter, relativeFilterFilename(filename, filter))) .join(uni_shared_1.LINEFEED) + uni_shared_1.LINEFEED + code; } else { files[filename] = code; } } }); return files; } exports.findMiniProgramTemplateFiles = findMiniProgramTemplateFiles; function clearMiniProgramTemplateFiles() { templateFilesCache.clear(); } exports.clearMiniProgramTemplateFiles = clearMiniProgramTemplateFiles; function addMiniProgramTemplateFile(filename, code) { templateFilesCache.set(filename, code); } exports.addMiniProgramTemplateFile = addMiniProgramTemplateFile; function getMiniProgramTemplateFilters(filename) { return templateFiltersCache.get(filename); } function clearMiniProgramTemplateFilter(filename) { templateFiltersCache.delete(filename); } exports.clearMiniProgramTemplateFilter = clearMiniProgramTemplateFilter; function addMiniProgramTemplateFilter(filename, filter) { const filters = templateFiltersCache.get(filename); if (filters) { const filterIndex = filters.findIndex((f) => f.id === filter.id); if (filterIndex > -1) { filters.splice(filterIndex, 1, filter); } else { filters.push(filter); } } else { templateFiltersCache.set(filename, [filter]); } } exports.addMiniProgramTemplateFilter = addMiniProgramTemplateFilter; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156478, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MP_PLUGIN_JSON_NAME = exports.COMPONENT_CUSTOM_HIDDEN_BIND = exports.COMPONENT_CUSTOM_HIDDEN = exports.COMPONENT_BIND_LINK = exports.COMPONENT_ON_LINK = void 0; exports.COMPONENT_ON_LINK = 'onVI'; exports.COMPONENT_BIND_LINK = '__l'; exports.COMPONENT_CUSTOM_HIDDEN = 'data-c-h'; exports.COMPONENT_CUSTOM_HIDDEN_BIND = 'bind:-' + exports.COMPONENT_CUSTOM_HIDDEN; exports.MP_PLUGIN_JSON_NAME = 'plugin.json'; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156479, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.copyMiniProgramThemeJson = exports.copyMiniProgramPluginJson = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const json_1 = require("../json/json"); const manifest_1 = require("../json/manifest"); exports.copyMiniProgramPluginJson = { src: ['plugin.json'], get dest() { return process.env.UNI_OUTPUT_DIR; }, transform(source) { return JSON.stringify((0, json_1.parseJson)(source.toString(), true), null, 2); }, }; const copyMiniProgramThemeJson = () => { if (!process.env.UNI_INPUT_DIR) return []; const manifestJson = (0, manifest_1.getPlatformManifestJsonOnce)(); const themeLocation = manifestJson.themeLocation || 'theme.json'; const hasThemeJson = fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, themeLocation)); if (hasThemeJson) { return [ { src: [(manifestJson.themeLocation = themeLocation)], get dest() { return process.env.UNI_OUTPUT_DIR; }, transform(source) { return JSON.stringify((0, json_1.parseJson)(source.toString(), true), null, 2); }, }, ]; } return []; }; exports.copyMiniProgramThemeJson = copyMiniProgramThemeJson; }, function(modId) { var map = {"../json/json":1745998156480}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156480, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseJson = void 0; const jsonc_parser_1 = require("jsonc-parser"); const preprocess_1 = require("../preprocess"); function parseJson(jsonStr, shouldPre = false) { return (0, jsonc_parser_1.parse)(shouldPre ? (0, preprocess_1.preJson)(jsonStr) : jsonStr); } exports.parseJson = parseJson; }, function(modId) { var map = {"../preprocess":1745998156481}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156481, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.preUVueJson = exports.preUVueCss = exports.preUVueHtml = exports.preUVueJs = exports.preNVueJson = exports.preNVueCss = exports.preNVueHtml = exports.preNVueJs = exports.preJson = exports.preCss = exports.preHtml = exports.preJs = exports.initPreContext = void 0; const context_1 = require("./context"); /* eslint-disable no-restricted-globals */ const { preprocess } = require('../../lib/preprocess'); var context_2 = require("./context"); Object.defineProperty(exports, "initPreContext", { enumerable: true, get: function () { return context_2.initPreContext; } }); function preJs(jsCode) { return preprocess(jsCode, (0, context_1.getPreVueContext)(), { type: 'js' }); } exports.preJs = preJs; function preHtml(htmlCode) { return preprocess(htmlCode, (0, context_1.getPreVueContext)(), { type: 'html' }); } exports.preHtml = preHtml; exports.preCss = preJs; exports.preJson = preJs; function preNVueJs(jsCode) { return preprocess(jsCode, (0, context_1.getPreNVueContext)(), { type: 'js' }); } exports.preNVueJs = preNVueJs; function preNVueHtml(htmlCode) { return preprocess(htmlCode, (0, context_1.getPreNVueContext)(), { type: 'html' }); } exports.preNVueHtml = preNVueHtml; exports.preNVueCss = preNVueJs; exports.preNVueJson = preNVueJs; function preUVueJs(jsCode) { return preprocess(jsCode, (0, context_1.getPreUVueContext)(), { type: 'js' }); } exports.preUVueJs = preUVueJs; function preUVueHtml(htmlCode) { return preprocess(htmlCode, (0, context_1.getPreUVueContext)(), { type: 'html' }); } exports.preUVueHtml = preUVueHtml; exports.preUVueCss = preUVueJs; exports.preUVueJson = preUVueJs; }, function(modId) { var map = {"./context":1745998156482}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156482, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initPreContext = exports.getPreUVueContext = exports.getPreNVueContext = exports.getPreVueContext = void 0; const shared_1 = require("@vue/shared"); const DEFAULT_KEYS = [ 'APP', 'APP_NVUE', 'APP_PLUS', 'APP_PLUS_NVUE', 'APP_VUE', 'APP_ANDROID', 'APP_IOS', 'H5', 'MP', 'MP_360', 'MP_ALIPAY', 'MP_BAIDU', 'MP_QQ', 'MP_LARK', 'MP_TOUTIAO', 'MP_WEIXIN', 'MP_KUAISHOU', 'MP_JD', 'QUICKAPP_NATIVE', 'QUICKAPP_WEBVIEW', 'QUICKAPP_WEBVIEW_HUAWEI', 'QUICKAPP_WEBVIEW_UNION', 'VUE2', 'VUE3', 'WEB', ]; const preVueContext = Object.create(null); const preNVueContext = Object.create(null); const preUVueContext = Object.create(null); function getPreVueContext() { return preVueContext; } exports.getPreVueContext = getPreVueContext; function getPreNVueContext() { return preNVueContext; } exports.getPreNVueContext = getPreNVueContext; function getPreUVueContext() { return preUVueContext; } exports.getPreUVueContext = getPreUVueContext; function initPreContext(platform, userPreContext, utsPlatform) { const vueContext = Object.create(null); const nvueContext = Object.create(null); const uvueContext = Object.create(null); const defaultContext = Object.create(null); DEFAULT_KEYS.forEach((key) => { defaultContext[key] = false; }); defaultContext[normalizeKey(platform)] = true; vueContext.VUE3 = true; nvueContext.VUE3 = true; uvueContext.VUE3 = true; if (platform === 'app' || platform === 'app-plus') { defaultContext.APP = true; defaultContext.APP_PLUS = true; vueContext.APP_VUE = true; nvueContext.APP_NVUE = true; nvueContext.APP_PLUS_NVUE = true; uvueContext.APP_UVUE = true; if (utsPlatform === 'app-android') { uvueContext.APP_ANDROID = true; } else if (utsPlatform === 'app-ios') { uvueContext.APP_IOS = true; } } else if (platform.startsWith('mp-')) { defaultContext.MP = true; } else if (platform.startsWith('quickapp-webview')) { defaultContext.QUICKAPP_WEBVIEW = true; } else if (platform === 'h5') { defaultContext.WEB = true; } if (userPreContext) { if ((0, shared_1.isString)(userPreContext)) { try { userPreContext = JSON.parse(userPreContext); } catch (e) { } } if ((0, shared_1.isPlainObject)(userPreContext)) { Object.keys(userPreContext).forEach((key) => { defaultContext[normalizeKey(key)] = !!userPreContext[key]; }); } } (0, shared_1.extend)(preVueContext, defaultContext, vueContext); (0, shared_1.extend)(preNVueContext, defaultContext, nvueContext); (0, shared_1.extend)(preUVueContext, defaultContext, uvueContext); } exports.initPreContext = initPreContext; function normalizeKey(name) { return name.replace(/-/g, '_').toUpperCase(); } }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156484, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformDynamicImports = exports.parseScriptDescriptor = exports.parseTemplateDescriptor = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.parseMainDescriptor = void 0; const types_1 = require("@babel/types"); const estree_walker_1 = require("estree-walker"); const magic_string_1 = __importDefault(require("magic-string")); const shared_1 = require("@vue/shared"); const uni_shared_1 = require("@dcloudio/uni-shared"); const messages_1 = require("../messages"); const constants_1 = require("../constants"); const utils_1 = require("../utils"); const utils_2 = require("../vite/utils"); const jsonFile_1 = require("../json/mp/jsonFile"); const mainDescriptors = new Map(); const scriptDescriptors = new Map(); const templateDescriptors = new Map(); function findImportTemplateSource(ast) { const importDeclaration = ast.body.find((node) => (0, types_1.isImportDeclaration)(node) && node.source.value.includes('vue&type=template')); if (importDeclaration) { return importDeclaration.source.value; } } function findImportScriptSource(ast) { const importDeclaration = ast.body.find((node) => (0, types_1.isImportDeclaration)(node) && node.source.value.includes('vue&type=script')); if (importDeclaration) { return importDeclaration.source.value; } } async function resolveSource(filename, source, resolve) { if (!source) { return; } const resolveId = await resolve(source, filename); if (resolveId) { return resolveId.id; } } async function parseMainDescriptor(filename, ast, resolve) { const script = await resolveSource(filename, findImportScriptSource(ast), resolve); const template = await resolveSource(filename, findImportTemplateSource(ast), resolve); const imports = await parseVueComponentImports(filename, ast.body.filter((node) => (0, types_1.isImportDeclaration)(node)), resolve); if (!script) { // inline script await parseScriptDescriptor(filename, ast, { resolve, isExternal: false }); } if (!template) { // inline template await parseTemplateDescriptor(filename, ast, { resolve, isExternal: false }); } const descriptor = { imports, script: script ? (0, utils_2.parseVueRequest)(script).filename : filename, template: template ? (0, utils_2.parseVueRequest)(template).filename : filename, }; mainDescriptors.set(filename, descriptor); return descriptor; } exports.parseMainDescriptor = parseMainDescriptor; function updateMiniProgramComponentsByScriptFilename(scriptFilename, inputDir, normalizeComponentName) { const mainFilename = findMainFilenameByScriptFilename(scriptFilename); if (mainFilename) { updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName); } } exports.updateMiniProgramComponentsByScriptFilename = updateMiniProgramComponentsByScriptFilename; function updateMiniProgramComponentsByTemplateFilename(templateFilename, inputDir, normalizeComponentName) { const mainFilename = findMainFilenameByTemplateFilename(templateFilename); if (mainFilename) { updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName); } } exports.updateMiniProgramComponentsByTemplateFilename = updateMiniProgramComponentsByTemplateFilename; function findMainFilenameByScriptFilename(scriptFilename) { const keys = [...mainDescriptors.keys()]; return keys.find((key) => mainDescriptors.get(key).script === scriptFilename); } function findMainFilenameByTemplateFilename(templateFilename) { const keys = [...mainDescriptors.keys()]; return keys.find((key) => mainDescriptors.get(key).template === templateFilename); } async function updateMiniProgramGlobalComponents(filename, ast, { inputDir, resolve, normalizeComponentName, }) { const { bindingComponents, imports } = await parseGlobalDescriptor(filename, ast, resolve); (0, jsonFile_1.addMiniProgramUsingComponents)('app', createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName)); return { imports, }; } exports.updateMiniProgramGlobalComponents = updateMiniProgramGlobalComponents; function createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName) { const usingComponents = {}; imports.forEach(({ source: { value }, specifiers: [specifier] }) => { const { name } = specifier.local; if (!bindingComponents[name]) { return; } const componentName = normalizeComponentName((0, shared_1.hyphenate)(bindingComponents[name].tag)); if (!usingComponents[componentName]) { usingComponents[componentName] = (0, uni_shared_1.addLeadingSlash)((0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)(value, inputDir))); } }); return usingComponents; } function updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName) { const mainDescriptor = mainDescriptors.get(mainFilename); if (!mainDescriptor) { return; } const templateDescriptor = templateDescriptors.get(mainDescriptor.template); if (!templateDescriptor) { return; } const scriptDescriptor = scriptDescriptors.get(mainDescriptor.script); if (!scriptDescriptor) { return; } const bindingComponents = parseBindingComponents({ ...templateDescriptor.bindingComponents, ...scriptDescriptor.setupBindingComponents, }, scriptDescriptor.bindingComponents); const imports = parseImports(mainDescriptor.imports, scriptDescriptor.imports, templateDescriptor.imports); (0, jsonFile_1.addMiniProgramUsingComponents)((0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)(mainFilename, inputDir)), createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName)); } exports.updateMiniProgramComponentsByMainFilename = updateMiniProgramComponentsByMainFilename; function findBindingComponent(tag, bindingComponents) { return Object.keys(bindingComponents).find((name) => { const componentTag = bindingComponents[name].tag; const camelName = (0, shared_1.camelize)(componentTag); const PascalName = (0, shared_1.capitalize)(camelName); return tag === componentTag || tag === camelName || tag === PascalName; }); } function normalizeComponentId(id) { // _unref(test) => test if (id.includes('_unref(')) { return id.replace('_unref(', '').replace(')', ''); } // $setup["test"] => test if (id.includes('$setup[')) { return id.replace('$setup["', '').replace('"', ''); } return id; } function parseBindingComponents(templateBindingComponents, scriptBindingComponents) { const bindingComponents = {}; Object.keys(templateBindingComponents).forEach((id) => { bindingComponents[normalizeComponentId(id)] = templateBindingComponents[id]; }); Object.keys(scriptBindingComponents).forEach((id) => { const { tag } = scriptBindingComponents[id]; const name = findBindingComponent(tag, templateBindingComponents); if (name) { bindingComponents[id] = bindingComponents[name]; } }); return bindingComponents; } function parseImports(mainImports, scriptImports, templateImports) { const imports = [...mainImports, ...templateImports, ...scriptImports]; return imports; } /** * 解析 template * @param filename * @param code * @param ast * @param options * @returns */ async function parseTemplateDescriptor(filename, ast, options) { // 外置时查找所有 vue component import const imports = options.isExternal ? await parseVueComponentImports(filename, ast.body.filter((node) => (0, types_1.isImportDeclaration)(node)), options.resolve) : []; const descriptor = { bindingComponents: findBindingComponents(ast.body), imports, }; templateDescriptors.set(filename, descriptor); return descriptor; } exports.parseTemplateDescriptor = parseTemplateDescriptor; async function parseGlobalDescriptor(filename, ast, resolve) { // 外置时查找所有 vue component import const imports = (await parseVueComponentImports(filename, ast.body.filter((node) => (0, types_1.isImportDeclaration)(node)), resolve)).filter((item) => !(0, utils_2.cleanUrl)(item.source.value).endsWith('App.vue')); return { bindingComponents: parseGlobalComponents(ast), imports, }; } /** * 解析 script * @param filename * @param code * @param ast * @param options * @returns */ async function parseScriptDescriptor(filename, ast, options) { // 外置时查找所有 vue component import const imports = options.isExternal ? await parseVueComponentImports(filename, ast.body.filter((node) => (0, types_1.isImportDeclaration)(node)), options.resolve) : []; const descriptor = { bindingComponents: parseComponents(ast), setupBindingComponents: findBindingComponents(ast.body), imports, }; scriptDescriptors.set(filename, descriptor); return descriptor; } exports.parseScriptDescriptor = parseScriptDescriptor; /** * 解析编译器生成的 bindingComponents * @param ast * @returns */ function findBindingComponents(ast) { const mapping = findUnpluginComponents(ast); for (const node of ast) { if (!(0, types_1.isVariableDeclaration)(node)) { continue; } const declarator = node.declarations[0]; if ((0, types_1.isIdentifier)(declarator.id) && declarator.id.name === constants_1.BINDING_COMPONENTS) { const bindingComponents = JSON.parse(declarator.init.value); return Object.keys(bindingComponents).reduce((bindings, tag) => { const { name, type } = bindingComponents[tag]; bindings[mapping[name] || name] = { tag, type: type, }; return bindings; }, {}); } } return {}; } /** * 兼容:unplugin_components * https://github.com/dcloudio/uni-app/issues/3057 * @param ast * @returns */ function findUnpluginComponents(ast) { const res = Object.create(null); // if(!Array){} const ifStatement = ast.find((statement) => (0, types_1.isIfStatement)(statement) && (0, types_1.isUnaryExpression)(statement.test) && statement.test.operator === '!' && (0, types_1.isIdentifier)(statement.test.argument) && statement.test.argument.name === 'Array'); if (!ifStatement) { return res; } if (!(0, types_1.isBlockStatement)(ifStatement.consequent)) { return res; } for (const node of ifStatement.consequent.body) { if (!(0, types_1.isVariableDeclaration)(node)) { continue; } const { id, init } = node.declarations[0]; if ((0, types_1.isIdentifier)(id) && (0, types_1.isIdentifier)(init) && init.name.includes('unplugin_components')) { res[id.name] = init.name; } } return res; } /** * 查找全局组件定义:app.component('component-a',{}) * @param ast * @returns */ function parseGlobalComponents(ast) { const bindingComponents = {}; estree_walker_1.walk(ast, { enter(child) { if (!(0, types_1.isCallExpression)(child)) { return; } const { callee } = child; // .component if (!(0, types_1.isMemberExpression)(callee) || !(0, types_1.isIdentifier)(callee.property) || callee.property.name !== 'component') { return; } // .component('component-a',{}) const args = child.arguments; if (args.length !== 2) { return; } const [name, value] = args; if (!(0, types_1.isStringLiteral)(name)) { return console.warn(messages_1.M['mp.component.args[0]']); } if (!(0, types_1.isIdentifier)(value)) { return console.warn(messages_1.M['mp.component.args[1]']); } bindingComponents[value.name] = { tag: name.value, type: 'unknown', }; }, }); return bindingComponents; } /** * 从 components 中查找定义的组件 * @param ast * @param bindingComponents */ function parseComponents(ast) { const bindingComponents = {}; estree_walker_1.walk(ast, { enter(child) { if (!(0, types_1.isObjectExpression)(child)) { return; } const componentsProp = child.properties.find((prop) => (0, types_1.isObjectProperty)(prop) && (0, types_1.isIdentifier)(prop.key) && prop.key.name === 'components'); if (!componentsProp) { return; } const componentsExpr = componentsProp.value; if (!(0, types_1.isObjectExpression)(componentsExpr)) { return; } componentsExpr.properties.forEach((prop) => { if (!(0, types_1.isObjectProperty)(prop)) { return; } if (!(0, types_1.isIdentifier)(prop.key) && !(0, types_1.isStringLiteral)(prop.key)) { return; } if (!(0, types_1.isIdentifier)(prop.value)) { return; } bindingComponents[prop.value.name] = { tag: (0, types_1.isIdentifier)(prop.key) ? prop.key.name : prop.key.value, type: 'unknown', }; }); }, }); return bindingComponents; } /** * vue component imports * @param filename * @param imports * @param resolve * @returns */ async function parseVueComponentImports(importer, imports, resolve) { const vueComponentImports = []; for (let i = 0; i < imports.length; i++) { const { source } = imports[i]; if ((0, utils_2.parseVueRequest)(source.value).query.vue) { continue; } const resolveId = await resolve(source.value, importer); if (!resolveId) { continue; } const { filename } = (0, utils_2.parseVueRequest)(resolveId.id); if (constants_1.EXTNAME_VUE_RE.test(filename)) { source.value = resolveId.id; vueComponentImports.push(imports[i]); } } return vueComponentImports; } /** * static import => dynamic import * @param code * @param imports * @param dynamicImport * @returns */ async function transformDynamicImports(code, imports, { id, sourceMap, dynamicImport, }) { if (!imports.length) { return { code, map: null, }; } const s = new magic_string_1.default(code); for (let i = 0; i < imports.length; i++) { const { start, end, specifiers: [specifier], source, } = imports[i]; s.overwrite(start, end, dynamicImport(specifier.local.name, source.value) + ';'); } return { code: s.toString(), map: null, }; } exports.transformDynamicImports = transformDynamicImports; }, function(modId) { var map = {"../messages":1745998156485,"../constants":1745998156488,"../vite/utils":1745998156490}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156485, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.M = void 0; const os_locale_s_fix_1 = require("os-locale-s-fix"); const en_1 = __importDefault(require("./en")); const zh_CN_1 = __importDefault(require("./zh_CN")); function format(lang) { const array = lang.split(/[.,]/)[0].split(/[_-]/); array[0] = array[0].toLowerCase(); if (array[0] === 'zh') { array[1] = (array[1] || 'CN').toUpperCase(); } array.length = Math.min(array.length, 2); return array.join('_'); } const locale = format(process.env.UNI_HBUILDERX_LANGID || os_locale_s_fix_1.osLocale.sync({ spawn: true, cache: false }) || 'en'); exports.M = locale === 'zh_CN' ? zh_CN_1.default : en_1.default; }, function(modId) { var map = {"./en":1745998156486,"./zh_CN":1745998156487}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156486, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { 'app.compiler.version': 'Compiler version: {version}', compiling: 'Compiling...', 'dev.performance': 'Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.', 'dev.performance.nvue': 'Especially the sourcemap of app-nvue has a greater impact', 'dev.performance.mp': 'To officially release, please click the release menu or use the cli release command to release', 'build.done': 'DONE Build complete.', 'dev.watching.start': 'Compiling...', 'dev.watching.end': 'DONE Build complete. Watching for changes...', 'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}', 'dev.watching.end.files': 'DONE Build complete. FILES:{files}', 'compiler.build.failed': 'Build failed with errors.', 'stat.warn.appid': 'The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303', 'stat.warn.version': 'The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat', 'stat.warn.tip': 'uni statistics version: {version}', 'i18n.fallbackLocale.default': 'fallbackLocale is missing in manifest.json, use: {locale}', 'i18n.fallbackLocale.missing': './local/{locale}.json is missing', 'easycom.conflict': 'easycom component conflict: ', 'mp.component.args[0]': 'The first parameter of {0} must be a static string', 'mp.component.args[1]': '{0} requires two parameters', 'mp.360.unsupported': '360 is unsupported', 'file.notfound': '{file} is not found', 'uts.ios.tips': 'The project uses the uts plugin. After the uts plug-in code is modified, the [Custom playground native runner](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground) needs to be regenerated to take effect', 'uts.android.compiler.server': 'The project uses the uts plugin, installing the uts Android runtime extension...', 'uts.ios.windows.tips': 'When running on Windows to iOS mobile phone, the modification of the uts plugin code needs to be submitted to the cloud to package the custom playground to take effect.', 'uts.ios.standard.tips': 'When the standard playground runs to an IOS phone, the uts plugin is temporarily not supported. If you need to call the uts plugin, please use a custom playground', 'prompt.run.message': 'Run method: open {devtools}, import {outputDir} run.', 'prompt.run.devtools.app': 'HBuilderX', 'prompt.run.devtools.mp-alipay': 'Alipay Mini Program Devtools', 'prompt.run.devtools.mp-baidu': 'Baidu Mini Program Devtools', 'prompt.run.devtools.mp--kuaishou': 'Kuaishou Mini Program Devtools', 'prompt.run.devtools.mp-lark': 'Lark Mini Program Devtools', 'prompt.run.devtools.mp-qq': 'QQ Mini Program Devtools', 'prompt.run.devtools.mp-toutiao': 'Douyin Mini Program Devtools', 'prompt.run.devtools.mp-weixin': 'Weixin Mini Program Devtools', 'prompt.run.devtools.mp-jd': 'Jingdong Mini Program Devtools', 'prompt.run.devtools.mp-xhs': 'Xiaohongshu Mini Program Devtools', 'prompt.run.devtools.quickapp-webview': 'Quick App Alliance Devtools | Huawei Quick App Devtools', 'prompt.run.devtools.quickapp-webview-huawei': 'Huawei Quick App Devtools', 'prompt.run.devtools.quickapp-webview-union': 'Quick App Alliance Devtools', 'uvue.unsupported': 'uvue does not support {platform} platform', }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156487, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { 'app.compiler.version': '编译器版本:{version}', compiling: '正在编译中...', 'dev.performance': '请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。', 'dev.performance.nvue': '尤其是 app-nvue 的 sourcemap 影响较大', 'dev.performance.mp': '若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布', 'build.done': 'DONE Build complete.', 'dev.watching.start': '开始差量编译...', 'dev.watching.end': 'DONE Build complete. Watching for changes...', 'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}', 'dev.watching.end.files': 'DONE Build complete. FILES:{files}', 'compiler.build.failed': '编译失败', 'stat.warn.appid': '当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303', 'stat.warn.version': '当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat', 'stat.warn.tip': '已开启 uni统计{version} 版本', 'i18n.fallbackLocale.default': '当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{locale}', 'i18n.fallbackLocale.missing': '当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件', 'easycom.conflict': 'easycom组件冲突:', 'mp.component.args[0]': '{0}的第一个参数必须为静态字符串', 'mp.component.args[1]': '{0}需要两个参数', 'mp.360.unsupported': 'vue3暂不支持360小程序', 'file.notfound': '{file} 文件不存在', 'uts.ios.tips': '项目使用了uts插件,iOS平台uts插件代码修改后需要重新生成[自定义基座](https://uniapp.dcloud.net.cn/tutorial/run/run-app.html#customplayground)才能生效', 'uts.android.compiler.server': '项目使用了uts插件,正在安装 uts Android 运行扩展...', 'uts.ios.windows.tips': 'iOS手机在windows上使用标准基座真机运行无法使用uts插件,如需使用uts插件请提交云端打包自定义基座', 'uts.ios.standard.tips': 'iOS手机在标准基座真机运行暂不支持uts插件,如需调用uts插件请使用自定义基座', 'prompt.run.message': '运行方式:打开 {devtools}, 导入 {outputDir} 运行。', 'prompt.run.devtools.app': 'HBuilderX', 'prompt.run.devtools.mp-alipay': '支付宝小程序开发者工具', 'prompt.run.devtools.mp-baidu': '百度开发者工具', 'prompt.run.devtools.mp--kuaishou': '快手开发者工具', 'prompt.run.devtools.mp-lark': '飞书开发者工具', 'prompt.run.devtools.mp-qq': 'QQ小程序开发者工具', 'prompt.run.devtools.mp-toutiao': '抖音开发者工具', 'prompt.run.devtools.mp-weixin': '微信开发者工具', 'prompt.run.devtools.mp-jd': '京东开发者工具', 'prompt.run.devtools.mp-xhs': '小红书开发者工具', 'prompt.run.devtools.quickapp-webview': '快应用联盟开发者工具 | 华为快应用开发者工具', 'prompt.run.devtools.quickapp-webview-huawei': '华为快应用开发者工具', 'prompt.run.devtools.quickapp-webview-union': '快应用联盟开发者工具', 'uvue.unsupported': 'uvue 暂不支持 {platform} 平台', }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156488, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0; exports.PUBLIC_DIR = 'static'; exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx']; exports.EXTNAME_TS = ['.ts', '.tsx']; exports.EXTNAME_VUE = ['.vue', '.nvue']; exports.EXTNAME_VUE_TEMPLATE = ['.vue', '.nvue', '.jsx', '.tsx']; exports.EXTNAME_VUE_RE = /\.(vue|nvue)$/; exports.EXTNAME_JS_RE = /\.(js|jsx|ts|tsx|mjs)$/; exports.EXTNAME_TS_RE = /\.tsx?$/; exports.extensions = [ '.uts', '.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', ].concat(exports.EXTNAME_VUE); exports.PAGES_JSON_JS = 'pages-json-js'; exports.PAGES_JSON_UTS = 'pages-json-uts'; exports.MANIFEST_JSON_JS = 'manifest-json-js'; exports.MANIFEST_JSON_UTS = 'manifest-json-uts'; exports.JSON_JS_MAP = { 'pages.json': exports.PAGES_JSON_JS, 'manifest.json': exports.MANIFEST_JSON_JS, }; exports.ASSETS_INLINE_LIMIT = 40 * 1024; exports.APP_SERVICE_FILENAME = 'app-service.js'; exports.APP_CONFIG = 'app-config.js'; exports.APP_CONFIG_SERVICE = 'app-config-service.js'; exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__'; // APP 平台解析页面后缀的优先级 exports.PAGE_EXTNAME_APP = ['.nvue', '.vue', '.tsx', '.jsx', '.js']; // 其他平台解析页面后缀的优先级 exports.PAGE_EXTNAME = ['.vue', '.nvue', '.tsx', '.jsx', '.js']; exports.H5_API_STYLE_PATH = '@dcloudio/uni-h5/style/api/'; exports.H5_FRAMEWORK_STYLE_PATH = '@dcloudio/uni-h5/style/framework/'; exports.H5_COMPONENTS_STYLE_PATH = '@dcloudio/uni-h5/style/'; exports.BASE_COMPONENTS_STYLE_PATH = '@dcloudio/uni-components/style/'; exports.COMMON_EXCLUDE = [ /\/pages\.json\.js$/, /\/manifest\.json\.js$/, /\/vite\//, /\/@vue\//, /\/vue-router\//, /\/vuex\//, /\/vue-i18n\//, /\/@dcloudio\/uni-h5-vue/, /\/@dcloudio\/uni-shared/, /\/@dcloudio\/uni-h5\/style/, /\/@dcloudio\/uni-components\/style/, ]; exports.KNOWN_ASSET_TYPES = [ // images 'png', 'jpe?g', 'gif', 'svg', 'ico', 'webp', 'avif', // media 'mp4', 'webm', 'ogg', 'mp3', 'wav', 'flac', 'aac', // fonts 'woff2?', 'eot', 'ttf', 'otf', // other 'pdf', 'txt', ]; exports.DEFAULT_ASSETS_RE = new RegExp(`\\.(` + exports.KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`); exports.TEXT_STYLE = ['black', 'white']; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156490, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isCombineBuiltInCss = exports.buildInCssSet = void 0; __exportStar(require("./ast"), exports); __exportStar(require("./url"), exports); __exportStar(require("./plugin"), exports); __exportStar(require("./utils"), exports); // 内置组件css列表,h5平台需要合并进去首页css中 exports.buildInCssSet = new Set(); function isCombineBuiltInCss(config) { return config.command === 'build' && config.build.cssCodeSplit; } exports.isCombineBuiltInCss = isCombineBuiltInCss; }, function(modId) { var map = {"./ast":1745998156491,"./url":1745998156492,"./plugin":1745998156493,"./utils":1745998156496}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156491, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isSimpleExpressionNode = exports.isDirectiveNode = exports.isAttributeNode = exports.isElementNode = exports.parseVue = exports.createCallExpression = exports.createIdentifier = exports.createLiteral = exports.isReference = exports.isExportSpecifier = exports.isMethodDefinition = exports.isMemberExpression = exports.isCallExpression = exports.isAssignmentExpression = exports.isIdentifier = exports.isProperty = void 0; const compiler_dom_1 = require("@vue/compiler-dom"); const isProperty = (node) => node.type === 'Property'; exports.isProperty = isProperty; const isIdentifier = (node) => node.type === 'Identifier'; exports.isIdentifier = isIdentifier; const isAssignmentExpression = (node) => node.type === 'AssignmentExpression'; exports.isAssignmentExpression = isAssignmentExpression; const isCallExpression = (node) => node.type === 'CallExpression'; exports.isCallExpression = isCallExpression; const isMemberExpression = (node) => node.type === 'MemberExpression'; exports.isMemberExpression = isMemberExpression; const isMethodDefinition = (node) => node.type === 'MethodDefinition'; exports.isMethodDefinition = isMethodDefinition; const isExportSpecifier = (node) => node.type === 'ExportSpecifier'; exports.isExportSpecifier = isExportSpecifier; const isReference = (node, parent) => { if ((0, exports.isMemberExpression)(node)) { return !node.computed && (0, exports.isReference)(node.object, node); } if ((0, exports.isIdentifier)(node)) { if ((0, exports.isMemberExpression)(parent)) return parent.computed || node === parent.object; // `bar` in { bar: foo } if ((0, exports.isProperty)(parent) && node !== parent.value) return false; // `bar` in `class Foo { bar () {...} }` if ((0, exports.isMethodDefinition)(parent)) return false; // `bar` in `export { foo as bar }` if ((0, exports.isExportSpecifier)(parent) && node !== parent.local) return false; return true; } return false; }; exports.isReference = isReference; function createLiteral(value) { return { type: 'Literal', value, raw: `'${value}'`, }; } exports.createLiteral = createLiteral; function createIdentifier(name) { return { type: 'Identifier', name, }; } exports.createIdentifier = createIdentifier; function createCallExpression(callee, args) { return { type: 'CallExpression', callee, arguments: args, }; } exports.createCallExpression = createCallExpression; function parseVue(code, errors) { return (0, compiler_dom_1.parse)(code, { isNativeTag: () => true, isPreTag: () => true, getTextMode: () => 0 /* TextModes.DATA */, onError: (e) => { errors.push(e); }, }); } exports.parseVue = parseVue; function isElementNode(node) { return node.type === 1 /* NodeTypes.ELEMENT */; } exports.isElementNode = isElementNode; function isAttributeNode(node) { return node.type === 6 /* NodeTypes.ATTRIBUTE */; } exports.isAttributeNode = isAttributeNode; function isDirectiveNode(node) { return node.type === 7 /* NodeTypes.DIRECTIVE */; } exports.isDirectiveNode = isDirectiveNode; function isSimpleExpressionNode(node) { return node.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */; } exports.isSimpleExpressionNode = isSimpleExpressionNode; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156492, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isJsFile = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.isInternalRequest = exports.ENV_PUBLIC_PATH = exports.CLIENT_PUBLIC_PATH = exports.VALID_ID_PREFIX = exports.FS_PREFIX = exports.isImportRequest = exports.parseVueRequest = void 0; const shared_1 = require("@vue/shared"); const path_1 = __importDefault(require("path")); const constants_1 = require("../../constants"); function parseVueRequest(id) { const [filename, rawQuery] = id.split(`?`, 2); const query = Object.fromEntries(new URLSearchParams(rawQuery)); if (query.vue != null) { query.vue = true; } if (query.src != null) { query.src = true; } if (query.index != null) { query.index = Number(query.index); } if (query.raw != null) { query.raw = true; } return { filename, query, }; } exports.parseVueRequest = parseVueRequest; const importQueryRE = /(\?|&)import=?(?:&|$)/; const isImportRequest = (url) => importQueryRE.test(url); exports.isImportRequest = isImportRequest; /** * Prefix for resolved fs paths, since windows paths may not be valid as URLs. */ exports.FS_PREFIX = `/@fs/`; /** * Prefix for resolved Ids that are not valid browser import specifiers */ exports.VALID_ID_PREFIX = `/@id/`; exports.CLIENT_PUBLIC_PATH = `/@vite/client`; exports.ENV_PUBLIC_PATH = `/@vite/env`; const internalPrefixes = [ exports.FS_PREFIX, exports.VALID_ID_PREFIX, exports.CLIENT_PUBLIC_PATH, exports.ENV_PUBLIC_PATH, ]; const InternalPrefixRE = new RegExp(`^(?:${internalPrefixes.join('|')})`); const isInternalRequest = (url) => InternalPrefixRE.test(url); exports.isInternalRequest = isInternalRequest; exports.queryRE = /\?.*$/; exports.hashRE = /#.*$/; const cleanUrl = (url) => url.replace(exports.hashRE, '').replace(exports.queryRE, ''); exports.cleanUrl = cleanUrl; function isJsFile(id) { const { filename, query } = parseVueRequest(id); const isJs = constants_1.EXTNAME_JS_RE.test(filename); if (isJs) { return true; } const isVueJs = constants_1.EXTNAME_VUE.includes(path_1.default.extname(filename)) && (!query.vue || query.setup || (0, shared_1.hasOwn)(query, 'lang.ts')); if (isVueJs) { return true; } return false; } exports.isJsFile = isJsFile; }, function(modId) { var map = {"../../constants":1745998156488}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156493, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.insertBeforePlugin = exports.removePlugins = exports.replacePlugins = exports.injectCssPostPlugin = exports.injectCssPlugin = exports.injectAssetPlugin = void 0; const shared_1 = require("@vue/shared"); const asset_1 = require("../plugins/vitejs/plugins/asset"); const css_1 = require("../plugins/vitejs/plugins/css"); function injectAssetPlugin(config) { replacePlugins([(0, asset_1.assetPlugin)(config)], config); } exports.injectAssetPlugin = injectAssetPlugin; function injectCssPlugin(config) { replacePlugins([(0, css_1.cssPlugin)(config)], config); } exports.injectCssPlugin = injectCssPlugin; function injectCssPostPlugin(config, newCssPostPlugin) { const oldCssPostPlugin = config.plugins.find((p) => p.name === newCssPostPlugin.name); // 直接覆盖原有方法,不能删除,替换,因为 unocss 在 pre 阶段已经获取到了旧的 css-post 插件对象 if (oldCssPostPlugin) { (0, shared_1.extend)(oldCssPostPlugin, newCssPostPlugin); } } exports.injectCssPostPlugin = injectCssPostPlugin; function replacePlugins(plugins, config) { plugins.forEach((plugin) => { const index = config.plugins.findIndex((p) => p.name === plugin.name); if (index > -1) { ; config.plugins.splice(index, 1, plugin); } }); } exports.replacePlugins = replacePlugins; function removePlugins(plugins, config) { if (!(0, shared_1.isArray)(plugins)) { plugins = [plugins]; } plugins.forEach((name) => { const index = config.plugins.findIndex((p) => p.name === name); if (index > -1) { ; config.plugins.splice(index, 1); } }); } exports.removePlugins = removePlugins; function insertBeforePlugin(plugin, before, config) { const index = config.plugins.findIndex((p) => p.name === before); if (index > -1) { ; config.plugins.splice(index, 0, plugin); } } exports.insertBeforePlugin = insertBeforePlugin; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156496, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isSsr = exports.isInHybridNVue = exports.withSourcemap = void 0; function withSourcemap(config) { if (config.command === 'serve') { return true; } return !!config.build.sourcemap; } exports.withSourcemap = withSourcemap; function isInHybridNVue(config) { return config.nvue && process.env.UNI_RENDERER !== 'native'; } exports.isInHybridNVue = isInHybridNVue; function isSsr(command, config) { if (command === 'serve') { return !!(config.server && config.server.middlewareMode); } if (command === 'build') { return !!(config.build && config.build.ssr); } return false; } exports.isSsr = isSsr; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156498, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseExternalClasses = exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.hasExternalClasses = void 0; const types_1 = require("@babel/types"); const estree_walker_1 = require("estree-walker"); const externalClassesCache = new Map(); function hasExternalClasses(code) { return code.includes('externalClasses'); } exports.hasExternalClasses = hasExternalClasses; function findMiniProgramComponentExternalClasses(filename) { return externalClassesCache.get(filename); } exports.findMiniProgramComponentExternalClasses = findMiniProgramComponentExternalClasses; function updateMiniProgramComponentExternalClasses(filename, classes) { externalClassesCache.set(filename, classes); } exports.updateMiniProgramComponentExternalClasses = updateMiniProgramComponentExternalClasses; function parseExternalClasses(ast) { const classes = []; estree_walker_1.walk(ast, { enter(child, parent) { if (!(0, types_1.isIdentifier)(child) || child.name !== 'externalClasses') { return; } // export default { externalClasses: ['my-class'] } if (!(0, types_1.isObjectProperty)(parent)) { return; } if (!(0, types_1.isArrayExpression)(parent.value)) { return; } parent.value.elements.forEach((element) => { if ((0, types_1.isStringLiteral)(element)) { classes.push(element.value); } }); }, }); return classes; } exports.parseExternalClasses = parseExternalClasses; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156499, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeBase64Url = exports.encodeBase64Url = void 0; const base64url_1 = __importDefault(require("base64url")); function encodeBase64Url(str) { return base64url_1.default.encode(str); } exports.encodeBase64Url = encodeBase64Url; function decodeBase64Url(str) { return base64url_1.default.decode(str); } exports.decodeBase64Url = decodeBase64Url; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156500, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initH5Provide = exports.initAppProvide = exports.initDefine = void 0; var define_1 = require("./define"); Object.defineProperty(exports, "initDefine", { enumerable: true, get: function () { return define_1.initDefine; } }); var provide_1 = require("./provide"); Object.defineProperty(exports, "initAppProvide", { enumerable: true, get: function () { return provide_1.initAppProvide; } }); Object.defineProperty(exports, "initH5Provide", { enumerable: true, get: function () { return provide_1.initH5Provide; } }); }, function(modId) { var map = {"./define":1745998156501,"./provide":1745998156550}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156501, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initDefine = void 0; const env_1 = require("../hbx/env"); const json_1 = require("../json"); function initDefine(stringifyBoolean = false) { const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR); const platformManifestJson = (0, json_1.getPlatformManifestJsonOnce)(); const isRunByHBuilderX = (0, env_1.runByHBuilderX)(); const isDebug = !!manifestJson.debug; return { ...initCustomDefine(), 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), 'process.env.UNI_DEBUG': stringifyBoolean ? JSON.stringify(isDebug) : isDebug, 'process.env.UNI_APP_ID': JSON.stringify(manifestJson.appid || ''), 'process.env.UNI_APP_NAME': JSON.stringify(manifestJson.name || ''), 'process.env.UNI_APP_VERSION_NAME': JSON.stringify(manifestJson.versionName || ''), 'process.env.UNI_APP_VERSION_CODE': JSON.stringify(manifestJson.versionCode || ''), 'process.env.UNI_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM), 'process.env.UNI_SUB_PLATFORM': JSON.stringify(process.env.UNI_SUB_PLATFORM || ''), 'process.env.UNI_MP_PLUGIN': JSON.stringify(process.env.UNI_MP_PLUGIN || ''), 'process.env.UNI_SUBPACKAGE': JSON.stringify(process.env.UNI_SUBPACKAGE || ''), 'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION || ''), 'process.env.RUN_BY_HBUILDERX': stringifyBoolean ? JSON.stringify(isRunByHBuilderX) : isRunByHBuilderX, 'process.env.UNI_AUTOMATOR_WS_ENDPOINT': JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT || ''), 'process.env.UNI_CLOUD_PROVIDER': JSON.stringify(process.env.UNI_CLOUD_PROVIDER || ''), 'process.env.UNICLOUD_DEBUG': JSON.stringify(process.env.UNICLOUD_DEBUG || ''), // 兼容旧版本 'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM || ''), 'process.env.VUE_APP_DARK_MODE': JSON.stringify(platformManifestJson.darkmode || false), }; } exports.initDefine = initDefine; function initCustomDefine() { let define = {}; if (process.env.UNI_CUSTOM_DEFINE) { try { define = JSON.parse(process.env.UNI_CUSTOM_DEFINE); } catch (e) { } } return Object.keys(define).reduce((res, name) => { res['process.env.' + name] = JSON.stringify(define[name]); return res; }, {}); } }, function(modId) { var map = {"../hbx/env":1745998156502,"../json":1745998156506}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156502, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fixBinaryPath = exports.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void 0; const path_1 = __importDefault(require("path")); const module_1 = __importDefault(require("module")); const uni_shared_1 = require("@dcloudio/uni-shared"); const resolve_1 = require("../resolve"); const utils_1 = require("../utils"); exports.isInHBuilderX = (0, uni_shared_1.once)(() => { // 自动化测试传入了 HX_APP_ROOT(其实就是UNI_HBUILDERX_PLUGINS) if (process.env.HX_APP_ROOT) { process.env.UNI_HBUILDERX_PLUGINS = process.env.HX_APP_ROOT + '/plugins'; return true; } try { const { name } = require(path_1.default.resolve(process.cwd(), '../about/package.json')); if (name === 'about') { process.env.UNI_HBUILDERX_PLUGINS = path_1.default.resolve(process.cwd(), '..'); return true; } } catch (e) { // console.error(e) } return false; }); exports.runByHBuilderX = (0, uni_shared_1.once)(() => { return (!!process.env.UNI_HBUILDERX_PLUGINS && (!!process.env.RUN_BY_HBUILDERX || !!process.env.HX_Version)); }); /** * 增加 node_modules */ function initModulePaths() { if (!(0, exports.isInHBuilderX)()) { return; } const Module = module.constructor.length > 1 ? module.constructor : module_1.default; const nodeModulesPath = path_1.default.resolve(process.env.UNI_CLI_CONTEXT, 'node_modules'); const oldNodeModulePaths = Module._nodeModulePaths; Module._nodeModulePaths = function (from) { const paths = oldNodeModulePaths.call(this, from); if (!paths.includes(nodeModulesPath)) { paths.push(nodeModulesPath); } return paths; }; } exports.initModulePaths = initModulePaths; function resolveEsbuildModule(name) { try { return path_1.default.dirname(require.resolve(name + '/package.json', { paths: [path_1.default.dirname((0, resolve_1.resolveBuiltIn)('esbuild/package.json'))], })); } catch (e) { } return ''; } function fixBinaryPath() { // cli 工程在 HBuilderX 中运行 if (!(0, exports.isInHBuilderX)() && (0, exports.runByHBuilderX)()) { if (utils_1.isWindows) { const win64 = resolveEsbuildModule('esbuild-windows-64'); if (win64) { process.env.ESBUILD_BINARY_PATH = path_1.default.join(win64, 'esbuild.exe'); } } else { const arm64 = resolveEsbuildModule('esbuild-darwin-arm64'); if (arm64) { process.env.ESBUILD_BINARY_PATH = path_1.default.join(arm64, 'bin/esbuild'); } } } } exports.fixBinaryPath = fixBinaryPath; }, function(modId) { var map = {"../resolve":1745998156503}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156503, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveComponentsLibPath = exports.resolveVueI18nRuntime = exports.resolveBuiltIn = exports.getBuiltInPaths = exports.resolveMainPathOnce = exports.relativeFile = exports.requireResolve = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const debug_1 = __importDefault(require("debug")); const resolve_1 = __importDefault(require("resolve")); const uni_shared_1 = require("@dcloudio/uni-shared"); const utils_1 = require("./utils"); const env_1 = require("./hbx/env"); const constants_1 = require("./constants"); function requireResolve(filename, basedir) { return resolveWithSymlinks(filename, basedir); } exports.requireResolve = requireResolve; function resolveWithSymlinks(id, basedir) { return resolve_1.default.sync(id, { basedir, extensions: constants_1.extensions, // necessary to work with pnpm preserveSymlinks: true, }); } function relativeFile(from, to) { const relativePath = (0, utils_1.normalizePath)(path_1.default.relative(path_1.default.dirname(from), to)); return relativePath.startsWith('.') ? relativePath : './' + relativePath; } exports.relativeFile = relativeFile; exports.resolveMainPathOnce = (0, uni_shared_1.once)((inputDir) => { const mainUTSPath = path_1.default.resolve(inputDir, 'main.uts'); if (fs_1.default.existsSync(mainUTSPath)) { return (0, utils_1.normalizePath)(mainUTSPath); } const mainTsPath = path_1.default.resolve(inputDir, 'main.ts'); if (fs_1.default.existsSync(mainTsPath)) { return (0, utils_1.normalizePath)(mainTsPath); } return (0, utils_1.normalizePath)(path_1.default.resolve(inputDir, 'main.js')); }); const ownerModules = [ '@dcloudio/uni-app', '@dcloudio/vite-plugin-uni', '@dcloudio/uni-cli-shared', ]; const paths = []; function resolveNodeModulePath(modulePath) { const nodeModulesPaths = []; const nodeModulesPath = path_1.default.join(modulePath, 'node_modules'); if (fs_1.default.existsSync(nodeModulesPath)) { nodeModulesPaths.push(nodeModulesPath); } const index = modulePath.lastIndexOf('node_modules'); if (index > -1) { nodeModulesPaths.push(path_1.default.join(modulePath.slice(0, index), 'node_modules')); } return nodeModulesPaths; } function initPaths() { const cliContext = process.env.UNI_CLI_CONTEXT || process.cwd(); if (cliContext) { const pathSet = new Set(); pathSet.add(path_1.default.join(cliContext, 'node_modules')); if (!(0, env_1.isInHBuilderX)()) { ; [`@dcloudio/uni-` + process.env.UNI_PLATFORM, ...ownerModules].forEach((ownerModule) => { let pkgPath = ''; try { pkgPath = require.resolve(ownerModule + '/package.json', { paths: [cliContext], }); } catch (e) { } if (pkgPath) { resolveNodeModulePath(path_1.default.dirname(pkgPath)).forEach((nodeModulePath) => { pathSet.add(nodeModulePath); }); } }); } paths.push(...pathSet); (0, debug_1.default)('uni-paths')(paths); } } function getBuiltInPaths() { if (!paths.length) { initPaths(); } return paths; } exports.getBuiltInPaths = getBuiltInPaths; function resolveBuiltIn(path) { return require.resolve(path, { paths: getBuiltInPaths() }); } exports.resolveBuiltIn = resolveBuiltIn; function resolveVueI18nRuntime() { return path_1.default.resolve(__dirname, '../lib/vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'); } exports.resolveVueI18nRuntime = resolveVueI18nRuntime; let componentsLibPath = ''; function resolveComponentsLibPath() { if (!componentsLibPath) { if ((0, env_1.isInHBuilderX)()) { componentsLibPath = path_1.default.join(resolveBuiltIn('@dcloudio/uni-components/package.json'), '../lib'); } else { componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.env.UNI_INPUT_DIR), '../lib'); } } return componentsLibPath; } exports.resolveComponentsLibPath = resolveComponentsLibPath; }, function(modId) { var map = {"fs":1745998156463,"resolve":1745998156503,"./hbx/env":1745998156502,"./constants":1745998156488}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156506, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeUniAppXAppPagesJson = void 0; __exportStar(require("./mp"), exports); __exportStar(require("./app"), exports); __exportStar(require("./json"), exports); __exportStar(require("./pages"), exports); __exportStar(require("./manifest"), exports); __exportStar(require("./theme"), exports); var uniAppX_1 = require("./uniAppX"); Object.defineProperty(exports, "normalizeUniAppXAppPagesJson", { enumerable: true, get: function () { return uniAppX_1.normalizeUniAppXAppPagesJson; } }); }, function(modId) { var map = {"./mp":1745998156507,"./app":1745998156517,"./json":1745998156480,"./theme":1745998156516,"./uniAppX":1745998156547}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156507, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseMiniProgramProjectJson = exports.parseMiniProgramPagesJson = exports.mergeMiniProgramAppJson = void 0; __exportStar(require("./jsonFile"), exports); var pages_1 = require("./pages"); Object.defineProperty(exports, "mergeMiniProgramAppJson", { enumerable: true, get: function () { return pages_1.mergeMiniProgramAppJson; } }); Object.defineProperty(exports, "parseMiniProgramPagesJson", { enumerable: true, get: function () { return pages_1.parseMiniProgramPagesJson; } }); var project_1 = require("./project"); Object.defineProperty(exports, "parseMiniProgramProjectJson", { enumerable: true, get: function () { return project_1.parseMiniProgramProjectJson; } }); }, function(modId) { var map = {"./pages":1745998156509,"./project":1745998156514}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156509, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeMiniProgramAppJson = exports.parseMiniProgramPagesJson = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const shared_1 = require("@vue/shared"); const json_1 = require("../json"); const pages_1 = require("../pages"); const utils_1 = require("./utils"); const utils_2 = require("../../utils"); const project_1 = require("./project"); const manifest_1 = require("../manifest"); const theme_1 = require("../theme"); function parseMiniProgramPagesJson(jsonStr, platform, options = { subpackages: false }) { return parsePagesJson(jsonStr, platform, options); } exports.parseMiniProgramPagesJson = parseMiniProgramPagesJson; const NON_APP_JSON_KEYS = [ 'unipush', 'secureNetwork', 'usingComponents', 'optimization', 'scopedSlotsCompiler', 'usingComponents', 'uniStatistics', 'mergeVirtualHostAttributes', ]; function mergeMiniProgramAppJson(appJson, platformJson = {}) { Object.keys(platformJson).forEach((name) => { if (!(0, project_1.isMiniProgramProjectJsonKey)(name) && !NON_APP_JSON_KEYS.includes(name)) { appJson[name] = platformJson[name]; } }); } exports.mergeMiniProgramAppJson = mergeMiniProgramAppJson; function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, subpackages, windowOptionsMap, tabBarOptionsMap, tabBarItemOptionsMap, } = { subpackages: false, }) { let appJson = { pages: [], }; let pageJsons = {}; let nvuePages = []; // preprocess const pagesJson = (0, json_1.parseJson)(jsonStr, true); if (!pagesJson) { throw new Error(`[vite] Error: pages.json parse failed.\n`); } function addPageJson(pagePath, style) { const filename = path_1.default.join(process.env.UNI_INPUT_DIR, pagePath); if (fs_1.default.existsSync(filename + '.nvue') && !fs_1.default.existsSync(filename + '.vue')) { nvuePages.push(pagePath); } const windowOptions = {}; if (platform === 'mp-baidu') { // 仅百度小程序需要页面配置 component:true // 快手小程序反而不能配置 component:true,故不能统一添加,目前硬编码处理 windowOptions.component = true; } pageJsons[pagePath] = (0, shared_1.extend)(windowOptions, (0, utils_1.parseWindowOptions)(style, platform, windowOptionsMap)); } // pages (0, pages_1.validatePages)(pagesJson, jsonStr); pagesJson.pages.forEach((page) => { appJson.pages.push(page.path); addPageJson(page.path, page.style); }); // subpackages pagesJson.subPackages = pagesJson.subPackages || pagesJson.subpackages; if (pagesJson.subPackages) { if (subpackages) { appJson.subPackages = pagesJson.subPackages.map(({ root, pages, ...rest }) => { return (0, shared_1.extend)({ root, pages: pages.map((page) => { addPageJson((0, utils_2.normalizePath)(path_1.default.join(root, page.path)), page.style); return page.path; }), }, rest); }); } else { pagesJson.subPackages.forEach(({ root, pages }) => { pages.forEach((page) => { const pagePath = (0, utils_2.normalizePath)(path_1.default.join(root, page.path)); appJson.pages.push(pagePath); addPageJson(pagePath, page.style); }); }); } } // window if (pagesJson.globalStyle) { const windowOptions = (0, utils_1.parseWindowOptions)(pagesJson.globalStyle, platform, windowOptionsMap); const { usingComponents } = windowOptions; if (usingComponents) { delete windowOptions.usingComponents; appJson.usingComponents = usingComponents; } else { delete appJson.usingComponents; } appJson.window = windowOptions; } // tabBar if (pagesJson.tabBar) { const tabBar = (0, utils_1.parseTabBar)(pagesJson.tabBar, platform, tabBarOptionsMap, tabBarItemOptionsMap); if (tabBar) { appJson.tabBar = tabBar; } } ; ['preloadRule', 'workers', 'plugins', 'entryPagePath'].forEach((name) => { if ((0, shared_1.hasOwn)(pagesJson, name)) { appJson[name] = pagesJson[name]; } }); if (debug) { appJson.debug = debug; } if (networkTimeout) { appJson.networkTimeout = networkTimeout; } const manifestJson = (0, manifest_1.getPlatformManifestJsonOnce)(); if (!darkmode) { const { pages, window, tabBar } = (0, theme_1.initTheme)(manifestJson, appJson); (0, shared_1.extend)(appJson, JSON.parse(JSON.stringify({ pages, window, tabBar }))); delete appJson.darkmode; delete appJson.themeLocation; pageJsons = (0, theme_1.initTheme)(manifestJson, pageJsons); } else { const themeLocation = manifestJson.themeLocation || 'theme.json'; if ((0, theme_1.hasThemeJson)(path_1.default.join(process.env.UNI_INPUT_DIR, themeLocation))) appJson.themeLocation = themeLocation; } return { appJson, pageJsons, nvuePages, }; } }, function(modId) { var map = {"../json":1745998156480,"./utils":1745998156511,"./project":1745998156514,"../theme":1745998156516}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156511, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseTabBar = exports.parseWindowOptions = void 0; const shared_1 = require("@vue/shared"); const pages_1 = require("../pages"); function trimJson(json) { delete json.maxWidth; delete json.topWindow; delete json.leftWindow; delete json.rightWindow; if (json.tabBar) { delete json.tabBar.matchMedia; } return json; } function convert(to, from, map) { Object.keys(map).forEach((key) => { if ((0, shared_1.hasOwn)(from, map[key])) { to[key] = from[map[key]]; } }); return to; } function parseWindowOptions(style, platform, windowOptionsMap) { if (!style) { return {}; } const platformStyle = style[platform] || {}; (0, pages_1.removePlatformStyle)(trimJson(style)); const res = {}; if (windowOptionsMap) { return (0, shared_1.extend)(convert(res, style, windowOptionsMap), platformStyle); } return (0, shared_1.extend)(res, style, platformStyle); } exports.parseWindowOptions = parseWindowOptions; function trimTabBarJson(tabBar) { ; [ 'fontSize', 'height', 'iconWidth', 'midButton', 'selectedIndex', 'spacing', ].forEach((name) => { delete tabBar[name]; }); return tabBar; } function parseTabBar(tabBar, platform, tabBarOptionsMap, tabBarItemOptionsMap) { const platformStyle = tabBar[platform] || {}; (0, pages_1.removePlatformStyle)(trimTabBarJson(tabBar)); const res = {}; if (tabBarOptionsMap) { if (tabBarItemOptionsMap && tabBar.list) { tabBar.list = tabBar.list.map((item) => { return convert({}, item, tabBarItemOptionsMap); }); } convert(res, tabBar, tabBarOptionsMap); return (0, shared_1.extend)(res, platformStyle); } return (0, shared_1.extend)(res, tabBar, platformStyle); } exports.parseTabBar = parseTabBar; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156514, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseMiniProgramProjectJson = exports.isMiniProgramProjectJsonKey = void 0; const shared_1 = require("@vue/shared"); const merge_1 = require("merge"); const json_1 = require("../json"); const projectKeys = [ 'appid', 'setting', 'miniprogramRoot', 'cloudfunctionRoot', 'qcloudRoot', 'pluginRoot', 'compileType', 'libVersion', 'projectname', 'packOptions', 'debugOptions', 'scripts', 'cloudbaseRoot', ]; function isMiniProgramProjectJsonKey(name) { return projectKeys.includes(name); } exports.isMiniProgramProjectJsonKey = isMiniProgramProjectJsonKey; function parseMiniProgramProjectJson(jsonStr, platform, { template, pagesJson }) { const projectJson = JSON.parse(JSON.stringify(template)); const manifestJson = (0, json_1.parseJson)(jsonStr); if (manifestJson) { projectJson.projectname = manifestJson.name; const platformConfig = manifestJson[platform]; if (platformConfig) { projectKeys.forEach((name) => { if ((0, shared_1.hasOwn)(platformConfig, name)) { if ((0, shared_1.isPlainObject)(platformConfig[name]) && (0, shared_1.isPlainObject)(projectJson[name])) { ; projectJson[name] = (0, merge_1.recursive)(true, projectJson[name], platformConfig[name]); } else { ; projectJson[name] = platformConfig[name]; } } }); // 使用了微信小程序手势系统,自动开启 ES6=>ES5 platform === 'mp-weixin' && weixinSkyline(platformConfig) && openES62ES5(projectJson); } } // 其实仅开发期间 condition 生效即可,暂不做判断 const miniprogram = parseMiniProgramCondition(pagesJson); if (miniprogram) { if (!projectJson.condition) { projectJson.condition = {}; } projectJson.condition.miniprogram = miniprogram; } if (!projectJson.appid) { projectJson.appid = 'touristappid'; } return projectJson; } exports.parseMiniProgramProjectJson = parseMiniProgramProjectJson; function weixinSkyline(config) { return (config.renderer === 'skyline' && config.lazyCodeLoading === 'requiredComponents'); } function openES62ES5(config) { if (!config.setting) { config.setting = {}; } if (!config.setting.es6) { config.setting.es6 = true; } } function parseMiniProgramCondition(pagesJson) { const launchPagePath = process.env.UNI_CLI_LAUNCH_PAGE_PATH || ''; if (launchPagePath) { return { current: 0, list: [ { id: 0, name: launchPagePath, pathName: launchPagePath, query: process.env.UNI_CLI_LAUNCH_PAGE_QUERY || '', // 启动参数,在页面的onLoad函数里面得到。 }, ], }; } const condition = pagesJson.condition; if (!condition || !(0, shared_1.isArray)(condition.list) || !condition.list.length) { return; } condition.list.forEach(function (item, index) { item.id = item.id || index; if (item.path) { item.pathName = item.path; delete item.path; } }); return condition; } }, function(modId) { var map = {"../json":1745998156480}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156516, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.initTheme = exports.normalizeThemeConfigOnce = exports.parseThemeJson = exports.hasThemeJson = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const json_1 = require("./json"); const uni_shared_1 = require("@dcloudio/uni-shared"); function hasThemeJson(themeLocation) { if (!fs_1.default.existsSync(themeLocation)) { return false; } return true; } exports.hasThemeJson = hasThemeJson; const parseThemeJson = (themeLocation = 'theme.json') => { if (!themeLocation || !process.env.UNI_INPUT_DIR) { return {}; } themeLocation = path_1.default.join(process.env.UNI_INPUT_DIR, themeLocation); if (!hasThemeJson(themeLocation)) { return {}; } const jsonStr = fs_1.default.readFileSync(themeLocation, 'utf8'); return (0, json_1.parseJson)(jsonStr, true); }; exports.parseThemeJson = parseThemeJson; exports.normalizeThemeConfigOnce = (0, uni_shared_1.once)((manifestJsonPlatform = {}) => (0, exports.parseThemeJson)(manifestJsonPlatform.themeLocation)); function initTheme(manifestJson, pagesJson) { const platform = process.env.UNI_PLATFORM === 'app' ? 'app-plus' : process.env.UNI_PLATFORM; const manifestPlatform = manifestJson['plus'] || manifestJson[platform] || {}; const themeConfig = (0, exports.normalizeThemeConfigOnce)(manifestPlatform); return (0, uni_shared_1.normalizeStyles)(pagesJson, themeConfig); } exports.initTheme = initTheme; }, function(modId) { var map = {"./json":1745998156480}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156517, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.restoreGlobalCode = exports.arrayBufferCode = exports.polyfillCode = void 0; __exportStar(require("./pages"), exports); __exportStar(require("./manifest"), exports); var code_1 = require("./pages/code"); Object.defineProperty(exports, "polyfillCode", { enumerable: true, get: function () { return code_1.polyfillCode; } }); Object.defineProperty(exports, "arrayBufferCode", { enumerable: true, get: function () { return code_1.arrayBufferCode; } }); Object.defineProperty(exports, "restoreGlobalCode", { enumerable: true, get: function () { return code_1.restoreGlobalCode; } }); }, function(modId) { var map = {"./pages":1745998156518,"./manifest":1745998156525,"./pages/code":1745998156519}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156518, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeAppConfigService = exports.normalizeAppNVuePagesJson = exports.normalizeAppPagesJson = void 0; const code_1 = require("./code"); const definePage_1 = require("./definePage"); const uniConfig_1 = require("./uniConfig"); const uniRoutes_1 = require("./uniRoutes"); function normalizeAppPagesJson(pagesJson) { return (0, definePage_1.definePageCode)(pagesJson); } exports.normalizeAppPagesJson = normalizeAppPagesJson; function normalizeAppNVuePagesJson(pagesJson) { return (0, definePage_1.defineNVuePageCode)(pagesJson); } exports.normalizeAppNVuePagesJson = normalizeAppNVuePagesJson; function normalizeAppConfigService(pagesJson, manifestJson) { return ` ;(function(){ let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[]; const __uniConfig = ${(0, uniConfig_1.normalizeAppUniConfig)(pagesJson, manifestJson)}; const __uniRoutes = ${(0, uniRoutes_1.normalizeAppUniRoutes)(pagesJson)}.map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute)); __uniConfig.styles=${process.env.UNI_NVUE_APP_STYLES || '[]'};//styles __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:16})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,${code_1.globalCode}}}}}); })(); `; } exports.normalizeAppConfigService = normalizeAppConfigService; }, function(modId) { var map = {"./code":1745998156519,"./definePage":1745998156520,"./uniRoutes":1745998156523}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156519, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.globalCode = exports.restoreGlobalCode = exports.polyfillCode = exports.arrayBufferCode = void 0; exports.arrayBufferCode = ` if (typeof uni !== 'undefined' && uni && uni.requireGlobal) { const global = uni.requireGlobal() ArrayBuffer = global.ArrayBuffer Int8Array = global.Int8Array Uint8Array = global.Uint8Array Uint8ClampedArray = global.Uint8ClampedArray Int16Array = global.Int16Array Uint16Array = global.Uint16Array Int32Array = global.Int32Array Uint32Array = global.Uint32Array Float32Array = global.Float32Array Float64Array = global.Float64Array BigInt64Array = global.BigInt64Array BigUint64Array = global.BigUint64Array }; `; exports.polyfillCode = ` if (typeof Promise !== 'undefined' && !Promise.prototype.finally) { Promise.prototype.finally = function(callback) { const promise = this.constructor return this.then( value => promise.resolve(callback()).then(() => value), reason => promise.resolve(callback()).then(() => { throw reason }) ) } }; ${exports.arrayBufferCode} `; exports.restoreGlobalCode = ` if(uni.restoreGlobal){ uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval) } `; const GLOBALS = [ 'global', 'window', 'document', 'frames', 'self', 'location', 'navigator', 'localStorage', 'history', 'Caches', 'screen', 'alert', 'confirm', 'prompt', 'fetch', 'XMLHttpRequest', 'WebSocket', 'webkit', 'print', ]; exports.globalCode = GLOBALS.map((g) => `${g}:u`).join(','); }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156520, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.defineNVuePageCode = exports.definePageCode = void 0; const utils_1 = require("../../../utils"); function definePageCode(pagesJson) { const importPagesCode = []; const definePagesCode = []; pagesJson.pages.forEach((page) => { if (page.style.isNVue) { return; } const pagePath = page.path; const pageIdentifier = (0, utils_1.normalizeIdentifier)(pagePath); const pagePathWithExtname = (0, utils_1.normalizePagePath)(pagePath, 'app'); if (pagePathWithExtname) { if (process.env.UNI_APP_CODE_SPLITING) { // 拆分页面 importPagesCode.push(`const ${pageIdentifier} = ()=>import('./${pagePathWithExtname}')`); } else { importPagesCode.push(`import ${pageIdentifier} from './${pagePathWithExtname}'`); } definePagesCode.push(`__definePage('${pagePath}',${pageIdentifier})`); } }); return importPagesCode.join('\n') + '\n' + definePagesCode.join('\n'); } exports.definePageCode = definePageCode; function defineNVuePageCode(pagesJson) { const importNVuePagesCode = []; pagesJson.pages.forEach((page) => { if (!page.style.isNVue) { return; } const pagePathWithExtname = (0, utils_1.normalizePagePath)(page.path, 'app'); if (pagePathWithExtname) { importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>{res.length})`); } }); return importNVuePagesCode.join('\n'); } exports.defineNVuePageCode = defineNVuePageCode; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156523, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeAppUniRoutes = void 0; const pages_1 = require("../../pages"); function normalizeAppUniRoutes(pagesJson) { return JSON.stringify((0, pages_1.normalizePagesRoute)(pagesJson)); } exports.normalizeAppUniRoutes = normalizeAppUniRoutes; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156525, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0; const shared_1 = require("@vue/shared"); const merge_1 = require("./merge"); const defaultManifestJson_1 = require("./defaultManifestJson"); const statusbar_1 = require("./statusbar"); const plus_1 = require("./plus"); const nvue_1 = require("./nvue"); const arguments_1 = require("./arguments"); const safearea_1 = require("./safearea"); const splashscreen_1 = require("./splashscreen"); const confusion_1 = require("./confusion"); const uniApp_1 = require("./uniApp"); const launchwebview_1 = require("./launchwebview"); const checksystemwebview_1 = require("./checksystemwebview"); const tabBar_1 = require("./tabBar"); const i18n_1 = require("./i18n"); const theme_1 = require("../../theme"); function normalizeAppManifestJson(userManifestJson, pagesJson) { const manifestJson = (0, merge_1.initRecursiveMerge)((0, defaultManifestJson_1.initDefaultManifestJson)(), userManifestJson); const { pages, globalStyle, tabBar } = (0, theme_1.initTheme)(manifestJson, pagesJson); (0, shared_1.extend)(pagesJson, JSON.parse(JSON.stringify({ pages, globalStyle, tabBar }))); (0, statusbar_1.initAppStatusbar)(manifestJson, pagesJson); (0, arguments_1.initArguments)(manifestJson, pagesJson); (0, plus_1.initPlus)(manifestJson, pagesJson); (0, nvue_1.initNVue)(manifestJson, pagesJson); (0, safearea_1.initSafearea)(manifestJson, pagesJson); (0, splashscreen_1.initSplashscreen)(manifestJson, userManifestJson); (0, confusion_1.initConfusion)(manifestJson); (0, uniApp_1.initUniApp)(manifestJson); // 依赖 initArguments 先执行 (0, tabBar_1.initTabBar)((0, launchwebview_1.initLaunchwebview)(manifestJson, pagesJson), manifestJson, pagesJson); // 依赖 initUniApp 先执行 (0, checksystemwebview_1.initCheckSystemWebview)(manifestJson); return (0, i18n_1.initI18n)(manifestJson); } exports.normalizeAppManifestJson = normalizeAppManifestJson; __exportStar(require("./env"), exports); var confusion_2 = require("./confusion"); Object.defineProperty(exports, "APP_CONFUSION_FILENAME", { enumerable: true, get: function () { return confusion_2.APP_CONFUSION_FILENAME; } }); Object.defineProperty(exports, "isConfusionFile", { enumerable: true, get: function () { return confusion_2.isConfusionFile; } }); Object.defineProperty(exports, "hasConfusionFile", { enumerable: true, get: function () { return confusion_2.hasConfusionFile; } }); var nvue_2 = require("./nvue"); Object.defineProperty(exports, "getNVueCompiler", { enumerable: true, get: function () { return nvue_2.getNVueCompiler; } }); Object.defineProperty(exports, "getNVueStyleCompiler", { enumerable: true, get: function () { return nvue_2.getNVueStyleCompiler; } }); Object.defineProperty(exports, "getNVueFlexDirection", { enumerable: true, get: function () { return nvue_2.getNVueFlexDirection; } }); }, function(modId) { var map = {"./merge":1745998156526,"./defaultManifestJson":1745998156527,"./statusbar":1745998156528,"./uniApp":1745998156535,"./checksystemwebview":1745998156538,"./i18n":1745998156540,"../../theme":1745998156516}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156526, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initRecursiveMerge = void 0; const merge_1 = require("merge"); function initRecursiveMerge(manifestJson, userManifestJson) { return (0, merge_1.recursive)(true, manifestJson, { id: userManifestJson.appid || '', name: userManifestJson.name || '', description: userManifestJson.description || '', version: { name: userManifestJson.versionName, code: userManifestJson.versionCode, }, locale: userManifestJson.locale, uniStatistics: userManifestJson.uniStatistics, }, { plus: userManifestJson['app-plus'] }); } exports.initRecursiveMerge = initRecursiveMerge; }, function(modId) { var map = {"merge":1745998156526}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156527, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initDefaultManifestJson = void 0; function initDefaultManifestJson() { return JSON.parse(defaultManifestJson); } exports.initDefaultManifestJson = initDefaultManifestJson; const defaultManifestJson = `{ "@platforms": [ "android", "iPhone", "iPad" ], "id": "__WEAPP_ID", "name": "__WEAPP_NAME", "version": { "name": "1.0", "code": "" }, "description": "", "developer": { "name": "", "email": "", "url": "" }, "permissions": {}, "plus": { "useragent": { "value": "uni-app appservice", "concatenate": true }, "splashscreen": { "target":"id:1", "autoclose": true, "waiting": true, "alwaysShowBeforeRender":true }, "popGesture": "close", "launchwebview": {} } }`; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156528, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initAppStatusbar = void 0; function initAppStatusbar(manifestJson, pagesJson) { const titleColor = pagesJson.pages[0].style.navigationBar.titleColor || pagesJson.globalStyle.navigationBar.titleColor || '#000000'; const backgroundColor = pagesJson.globalStyle.navigationBar.backgroundColor || '#000000'; manifestJson.plus.statusbar = { immersed: 'supportedDevice', style: titleColor === '#ffffff' ? 'light' : 'dark', background: backgroundColor, }; return manifestJson; } exports.initAppStatusbar = initAppStatusbar; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156535, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initUniApp = void 0; const nvue_1 = require("./nvue"); function initUniApp(manifestJson) { manifestJson.plus['uni-app'] = { control: 'uni-v3', vueVersion: '3', compilerVersion: process.env.UNI_COMPILER_VERSION, nvueCompiler: (0, nvue_1.getNVueCompiler)(manifestJson), renderer: 'auto', nvue: { 'flex-direction': (0, nvue_1.getNVueFlexDirection)(manifestJson), }, nvueLaunchMode: manifestJson.plus.nvueLaunchMode === 'fast' ? 'fast' : 'normal', }; delete manifestJson.plus.nvueLaunchMode; } exports.initUniApp = initUniApp; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156538, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initCheckSystemWebview = void 0; function initCheckSystemWebview(manifestJson) { // 检查Android系统webview版本 || 下载X5后启动 let plusWebView = manifestJson.plus.webView; if (plusWebView) { manifestJson.plus['uni-app'].webView = plusWebView; delete manifestJson.plus.webView; } else { manifestJson.plus['uni-app'].webView = { minUserAgentVersion: '49.0', }; } } exports.initCheckSystemWebview = initCheckSystemWebview; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156540, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initI18n = void 0; const uni_i18n_1 = require("@dcloudio/uni-i18n"); const i18n_1 = require("../../../i18n"); function initI18n(manifestJson) { const i18nOptions = (0, i18n_1.initI18nOptions)(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true); if (i18nOptions) { manifestJson = JSON.parse((0, uni_i18n_1.compileI18nJsonStr)(JSON.stringify(manifestJson), i18nOptions)); manifestJson.fallbackLocale = i18nOptions.locale; } return manifestJson; } exports.initI18n = initI18n; }, function(modId) { var map = {"../../../i18n":1745998156541}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156541, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveI18nLocale = exports.initLocales = exports.getLocaleFiles = exports.isUniAppLocaleFile = exports.initI18nOptionsOnce = exports.initI18nOptions = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const fast_glob_1 = require("fast-glob"); const shared_1 = require("@vue/shared"); const uni_shared_1 = require("@dcloudio/uni-shared"); const json_1 = require("./json"); const messages_1 = require("./messages"); function initI18nOptions(platform, inputDir, warning = false, withMessages = true) { const locales = initLocales(path_1.default.resolve(inputDir, 'locale'), withMessages); if (!Object.keys(locales).length) { return; } const manifestJson = (0, json_1.parseManifestJsonOnce)(inputDir); let fallbackLocale = manifestJson.fallbackLocale || 'en'; const locale = resolveI18nLocale(platform, Object.keys(locales), fallbackLocale); if (warning) { if (!fallbackLocale) { console.warn(messages_1.M['i18n.fallbackLocale.default'].replace('{locale}', locale)); } else if (locale !== fallbackLocale) { console.warn(messages_1.M['i18n.fallbackLocale.missing'].replace('{locale}', fallbackLocale)); } } return { locale, locales, delimiters: uni_shared_1.I18N_JSON_DELIMITERS, }; } exports.initI18nOptions = initI18nOptions; exports.initI18nOptionsOnce = (0, uni_shared_1.once)(initI18nOptions); const localeJsonRE = /uni-app.*.json/; function isUniAppLocaleFile(filepath) { if (!filepath) { return false; } return localeJsonRE.test(path_1.default.basename(filepath)); } exports.isUniAppLocaleFile = isUniAppLocaleFile; function parseLocaleJson(filepath) { let jsonObj = (0, json_1.parseJson)(fs_1.default.readFileSync(filepath, 'utf8')); if (isUniAppLocaleFile(filepath)) { jsonObj = jsonObj.common || {}; } return jsonObj; } function getLocaleFiles(cwd) { return (0, fast_glob_1.sync)('*.json', { cwd, absolute: true }); } exports.getLocaleFiles = getLocaleFiles; function initLocales(dir, withMessages = true) { if (!fs_1.default.existsSync(dir)) { return {}; } return fs_1.default.readdirSync(dir).reduce((res, filename) => { if (path_1.default.extname(filename) === '.json') { try { const locale = path_1.default .basename(filename) .replace(/(uni-app.)?(.*).json/, '$2'); if (withMessages) { (0, shared_1.extend)(res[locale] || (res[locale] = {}), parseLocaleJson(path_1.default.join(dir, filename))); } else { res[locale] = {}; } } catch (e) { } } return res; }, {}); } exports.initLocales = initLocales; function resolveI18nLocale(platform, locales, locale) { if (locale && locales.includes(locale)) { return locale; } const defaultLocales = ['zh-Hans', 'zh-Hant']; if (platform === 'app' || platform === 'h5') { defaultLocales.unshift('en'); } else { // 小程序 defaultLocales.push('en'); } return defaultLocales.find((locale) => locales.includes(locale)) || locales[0]; } exports.resolveI18nLocale = resolveI18nLocale; }, function(modId) { var map = {"fs":1745998156463,"./json":1745998156506,"./messages":1745998156485}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156547, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeUniAppXAppPagesJson = void 0; const path_1 = __importDefault(require("path")); const shared_1 = require("@vue/shared"); const json_1 = require("./json"); const pages_1 = require("./pages"); const utils_1 = require("../utils"); function normalizeUniAppXAppPagesJson(jsonStr) { const pagesJson = { pages: [], globalStyle: {}, }; let userPagesJson = { pages: [], globalStyle: {}, }; // preprocess try { userPagesJson = (0, json_1.parseJson)(jsonStr, true); } catch (e) { console.error(`[vite] Error: pages.json parse failed.\n`, jsonStr, e); } // pages (0, pages_1.validatePages)(userPagesJson, jsonStr); userPagesJson.subPackages = userPagesJson.subPackages || userPagesJson.subpackages; // subPackages if (userPagesJson.subPackages) { userPagesJson.pages.push(...normalizeSubPackages(userPagesJson.subPackages)); } pagesJson.pages = userPagesJson.pages; // pageStyle normalizePages(pagesJson.pages); // globalStyle pagesJson.globalStyle = normalizePageStyle(userPagesJson.globalStyle); // tabBar if (userPagesJson.tabBar) { pagesJson.tabBar = userPagesJson.tabBar; } return pagesJson; } exports.normalizeUniAppXAppPagesJson = normalizeUniAppXAppPagesJson; function normalizeSubPackages(subPackages) { const pages = []; if ((0, shared_1.isArray)(subPackages)) { subPackages.forEach(({ root, pages: subPages }) => { if (root && subPages.length) { subPages.forEach((subPage) => { subPage.path = (0, utils_1.normalizePath)(path_1.default.join(root, subPage.path)); subPage.style = subPage.style; pages.push(subPage); }); } }); } return pages; } function normalizePages(pages) { pages.forEach((page) => { page.style = normalizePageStyle(page.style); }); } function normalizePageStyle(pageStyle) { if (pageStyle) { (0, shared_1.extend)(pageStyle, pageStyle['app']); (0, pages_1.removePlatformStyle)(pageStyle); return pageStyle; } return {}; } }, function(modId) { var map = {"./json":1745998156480}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156550, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.initH5Provide = exports.initAppProvide = void 0; const path_1 = __importDefault(require("path")); const libDir = path_1.default.resolve(__dirname, '../../lib'); function initAppProvide() { const cryptoDefine = [path_1.default.join(libDir, 'crypto.js'), 'default']; return { __f__: ['@dcloudio/uni-app', 'formatAppLog'], crypto: cryptoDefine, 'window.crypto': cryptoDefine, 'global.crypto': cryptoDefine, 'uni.getCurrentSubNVue': ['@dcloudio/uni-app', 'getCurrentSubNVue'], 'uni.requireNativePlugin': ['@dcloudio/uni-app', 'requireNativePlugin'], }; } exports.initAppProvide = initAppProvide; function initH5Provide() { return { __f__: ['@dcloudio/uni-app', 'formatH5Log'], }; } exports.initH5Provide = initH5Provide; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156551, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.uniHBuilderXConsolePlugin = exports.formatInstallHBuilderXPluginTips = exports.installHBuilderXPlugin = exports.initModuleAlias = exports.formatAtFilename = void 0; const path_1 = __importDefault(require("path")); const utils_1 = require("../utils"); const console_1 = require("../vite/plugins/console"); var log_1 = require("./log"); Object.defineProperty(exports, "formatAtFilename", { enumerable: true, get: function () { return log_1.formatAtFilename; } }); __exportStar(require("./env"), exports); var alias_1 = require("./alias"); Object.defineProperty(exports, "initModuleAlias", { enumerable: true, get: function () { return alias_1.initModuleAlias; } }); Object.defineProperty(exports, "installHBuilderXPlugin", { enumerable: true, get: function () { return alias_1.installHBuilderXPlugin; } }); Object.defineProperty(exports, "formatInstallHBuilderXPluginTips", { enumerable: true, get: function () { return alias_1.formatInstallHBuilderXPluginTips; } }); function uniHBuilderXConsolePlugin(method = '__f__') { return (0, console_1.uniConsolePlugin)({ method, filename(filename) { filename = path_1.default.relative(process.env.UNI_INPUT_DIR, filename); if (filename.startsWith('.') || path_1.default.isAbsolute(filename)) { return ''; } return (0, utils_1.normalizePath)(filename); }, }); } exports.uniHBuilderXConsolePlugin = uniHBuilderXConsolePlugin; }, function(modId) { var map = {"../vite/plugins/console":1745998156553,"./env":1745998156502,"./alias":1745998156557}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156553, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.uniConsolePlugin = void 0; const debug_1 = __importDefault(require("debug")); const pluginutils_1 = require("@rollup/pluginutils"); const utils_1 = require("../utils"); const console_1 = require("../../logs/console"); const utils_2 = require("../../vite/utils/utils"); const debugConsole = (0, debug_1.default)('uni:console'); function uniConsolePlugin(options) { const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude); let resolvedConfig; return { name: 'uni:console', enforce: 'pre', configResolved(config) { resolvedConfig = config; }, transform(code, id) { if (!filter(id)) return null; if (!(0, utils_1.isJsFile)(id)) return null; let { filename } = (0, utils_1.parseVueRequest)(id); if (options.filename) { filename = options.filename(filename); } if (!filename) { return null; } if (!code.includes('console.')) { return null; } debugConsole(id); return (0, console_1.rewriteConsoleExpr)(options.method, id, filename, code, (0, utils_2.withSourcemap)(resolvedConfig)); }, }; } exports.uniConsolePlugin = uniConsolePlugin; }, function(modId) { var map = {"../utils":1745998156490,"../../logs/console":1745998156554,"../../vite/utils/utils":1745998156496}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156554, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.rewriteConsoleExpr = void 0; const magic_string_1 = __importDefault(require("magic-string")); const utils_1 = require("../utils"); function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) { filename = (0, utils_1.normalizePath)(filename); const re = /(console\.(log|info|debug|warn|error))\(([^)]+)\)/g; const locate = getLocator(code); const s = new magic_string_1.default(code); let match; while ((match = re.exec(code))) { const [, expr, type] = match; s.overwrite(match.index, match.index + expr.length + 1, method + `('${type}','at ${filename}:${locate(match.index).line + 1}',`); } return { code: s.toString(), map: sourceMap ? s.generateMap({ source: id, hires: true }) : null, }; } exports.rewriteConsoleExpr = rewriteConsoleExpr; function getLocator(source) { const originalLines = source.split('\n'); const lineOffsets = []; for (let i = 0, pos = 0; i < originalLines.length; i++) { lineOffsets.push(pos); pos += originalLines[i].length + 1; } return function locate(index) { let i = 0; let j = lineOffsets.length; while (i < j) { const m = (i + j) >> 1; if (index < lineOffsets[m]) { j = m; } else { i = m + 1; } } const line = i - 1; const column = index - lineOffsets[line]; return { line, column }; }; } }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156557, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatInstallHBuilderXPluginTips = exports.moduleAliasFormatter = exports.installHBuilderXPlugin = exports.initModuleAlias = void 0; const path_1 = __importDefault(require("path")); const module_alias_1 = __importDefault(require("module-alias")); const resolve_1 = __importDefault(require("resolve")); const env_1 = require("./env"); const hbxPlugins = { // typescript: 'compile-typescript/node_modules/typescript', less: 'compile-less/node_modules/less', sass: 'compile-dart-sass/node_modules/sass', stylus: 'compile-stylus/node_modules/stylus', pug: 'compile-pug-cli/node_modules/pug', }; function initModuleAlias() { const compilerSfcPath = require.resolve('@vue/compiler-sfc'); const serverRendererPath = require.resolve('@vue/server-renderer'); module_alias_1.default.addAliases({ '@vue/shared': require.resolve('@vue/shared'), '@vue/shared/dist/shared.esm-bundler.js': require.resolve('@vue/shared/dist/shared.esm-bundler.js'), '@vue/compiler-dom': require.resolve('@vue/compiler-dom'), '@vue/compiler-sfc': compilerSfcPath, '@vue/server-renderer': serverRendererPath, 'vue/compiler-sfc': compilerSfcPath, 'vue/server-renderer': serverRendererPath, }); if (process.env.VITEST) { module_alias_1.default.addAliases({ vue: '@dcloudio/uni-h5-vue', 'vue/package.json': '@dcloudio/uni-h5-vue/package.json', }); } if ((0, env_1.isInHBuilderX)()) { // 又是为了复用 HBuilderX 的插件逻辑,硬编码映射 Object.keys(hbxPlugins).forEach((name) => { module_alias_1.default.addAlias(name, path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, hbxPlugins[name])); }); // https://github.com/vitejs/vite/blob/892916d040a035edde1add93c192e0b0c5c9dd86/packages/vite/src/node/plugins/css.ts#L1481 const oldSync = resolve_1.default.sync; resolve_1.default.sync = (id, opts) => { if (hbxPlugins[id]) { return path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, hbxPlugins[id]); } return oldSync(id, opts); }; } } exports.initModuleAlias = initModuleAlias; function supportAutoInstallPlugin() { return !!process.env.HX_Version; } function installHBuilderXPlugin(plugin) { if (!supportAutoInstallPlugin()) { return; } return console.error(`%HXRunUniAPPPluginName%${plugin}%HXRunUniAPPPluginName%`); } exports.installHBuilderXPlugin = installHBuilderXPlugin; const installPreprocessorTips = {}; exports.moduleAliasFormatter = { test(msg) { return msg.includes('Preprocessor dependency'); }, format(msg) { let lang = ''; let preprocessor = ''; if (msg.includes(`"sass"`)) { lang = 'sass'; preprocessor = 'compile-dart-sass'; } else if (msg.includes(`"less"`)) { lang = 'less'; preprocessor = 'compile-less'; } else if (msg.includes('"stylus"')) { lang = 'stylus'; preprocessor = 'compile-stylus'; } if (lang) { // 仅提醒一次 if (installPreprocessorTips[lang]) { return ''; } installPreprocessorTips[lang] = true; installHBuilderXPlugin(preprocessor); return formatInstallHBuilderXPluginTips(lang, preprocessor); } return msg; }, }; function formatInstallHBuilderXPluginTips(lang, preprocessor) { return `预编译器错误:代码使用了${lang}语言,但未安装相应的编译器插件,${supportAutoInstallPlugin() ? '正在从' : '请前往'}插件市场安装该插件: https://ext.dcloud.net.cn/plugin?name=${preprocessor}`; } exports.formatInstallHBuilderXPluginTips = formatInstallHBuilderXPluginTips; }, function(modId) { var map = {"./env":1745998156502}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156558, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.stripOptions = void 0; exports.stripOptions = { include: ['**/*.js', '**/*.ts', '**/*.tsx', '**/*.vue'], functions: [ 'onBeforeMount', 'onMounted', 'onBeforeUpdate', 'onUpdated', 'onActivated', 'onDeactivated', 'onBeforeActivate', 'onBeforeDeactivate', 'onBeforeUnmount', 'onUnmounted', 'onRenderTracked', 'onRenderTriggered', ], }; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156559, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isExternalUrl = exports.transformUniH5Jsx = void 0; __exportStar(require("./transforms"), exports); __exportStar(require("./utils"), exports); __exportStar(require("./parse"), exports); var babel_1 = require("./babel"); Object.defineProperty(exports, "transformUniH5Jsx", { enumerable: true, get: function () { return babel_1.transformUniH5Jsx; } }); var templateUtils_1 = require("./transforms/templateUtils"); Object.defineProperty(exports, "isExternalUrl", { enumerable: true, get: function () { return templateUtils_1.isExternalUrl; } }); }, function(modId) { var map = {"./transforms":1745998156560,"./utils":1745998156564,"./parse":1745998156573,"./babel":1745998156574,"./transforms/templateUtils":1745998156566}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156560, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformComponentLink = exports.transformTapToClick = exports.transformMatchMedia = exports.transformH5BuiltInComponents = exports.matchTransformModel = exports.createTransformModel = exports.matchTransformOn = exports.createTransformOn = exports.ATTR_DATASET_EVENT_OPTS = exports.STRINGIFY_JSON = exports.createSrcsetTransformWithOptions = exports.createAssetUrlTransformWithOptions = void 0; const uni_shared_1 = require("@dcloudio/uni-shared"); const transformTag_1 = require("./transformTag"); const transformEvent_1 = require("./transformEvent"); const transformComponent_1 = require("./transformComponent"); const constants_1 = require("../../mp/constants"); __exportStar(require("./transformRef"), exports); __exportStar(require("./transformPageHead"), exports); __exportStar(require("./transformComponent"), exports); __exportStar(require("./transformEvent"), exports); __exportStar(require("./transformTag"), exports); var templateTransformAssetUrl_1 = require("./templateTransformAssetUrl"); Object.defineProperty(exports, "createAssetUrlTransformWithOptions", { enumerable: true, get: function () { return templateTransformAssetUrl_1.createAssetUrlTransformWithOptions; } }); var templateTransformSrcset_1 = require("./templateTransformSrcset"); Object.defineProperty(exports, "createSrcsetTransformWithOptions", { enumerable: true, get: function () { return templateTransformSrcset_1.createSrcsetTransformWithOptions; } }); var vOn_1 = require("./vOn"); Object.defineProperty(exports, "STRINGIFY_JSON", { enumerable: true, get: function () { return vOn_1.STRINGIFY_JSON; } }); Object.defineProperty(exports, "ATTR_DATASET_EVENT_OPTS", { enumerable: true, get: function () { return vOn_1.ATTR_DATASET_EVENT_OPTS; } }); Object.defineProperty(exports, "createTransformOn", { enumerable: true, get: function () { return vOn_1.createTransformOn; } }); Object.defineProperty(exports, "matchTransformOn", { enumerable: true, get: function () { return vOn_1.defaultMatch; } }); var vModel_1 = require("./vModel"); Object.defineProperty(exports, "createTransformModel", { enumerable: true, get: function () { return vModel_1.createTransformModel; } }); Object.defineProperty(exports, "matchTransformModel", { enumerable: true, get: function () { return vModel_1.defaultMatch; } }); exports.transformH5BuiltInComponents = (0, transformTag_1.createTransformTag)(uni_shared_1.BUILT_IN_TAG_NAMES.reduce((tags, tag) => ((tags[tag] = uni_shared_1.COMPONENT_PREFIX + tag), tags), {})); exports.transformMatchMedia = (0, transformTag_1.createTransformTag)({ 'match-media': 'uni-match-media', }); exports.transformTapToClick = (0, transformEvent_1.createTransformEvent)({ tap: (node) => { // 地图组件有自己特定的 tap 事件 if (node.tag === 'map' || node.tag === 'v-uni-map') { return 'tap'; } return 'click'; }, }); exports.transformComponentLink = (0, transformComponent_1.createTransformComponentLink)(constants_1.COMPONENT_BIND_LINK); }, function(modId) { var map = {"./transformTag":1745998156561,"./transformEvent":1745998156562,"./transformComponent":1745998156563,"../../mp/constants":1745998156478,"./transformRef":1745998156568,"./transformPageHead":1745998156569,"./templateTransformAssetUrl":1745998156565,"./templateTransformSrcset":1745998156567,"./vOn":1745998156571,"./vModel":1745998156572}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156561, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createTransformTag = void 0; const ast_1 = require("../../vite/utils/ast"); function createTransformTag(opts) { return function transformTag(node, context) { if (!(0, ast_1.isElementNode)(node)) { return; } const oldTag = node.tag; const newTag = opts[oldTag]; if (!newTag) { return; } node.tag = newTag; }; } exports.createTransformTag = createTransformTag; }, function(modId) { var map = {"../../vite/utils/ast":1745998156491}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156562, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createTransformEvent = void 0; const shared_1 = require("@vue/shared"); const ast_1 = require("../../vite/utils/ast"); function createTransformEvent(options) { return function transformEvent(node) { if (!(0, ast_1.isElementNode)(node)) { return; } node.props.forEach((prop) => { const { name, arg } = prop; if (name === 'on' && arg && (0, ast_1.isSimpleExpressionNode)(arg)) { const eventType = options[arg.content]; if (eventType) { // e.g tap => click if ((0, shared_1.isFunction)(eventType)) { arg.content = eventType(node, prop); } else { arg.content = eventType; } } } }); }; } exports.createTransformEvent = createTransformEvent; }, function(modId) { var map = {"../../vite/utils/ast":1745998156491}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156563, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createTransformComponentLink = void 0; const compiler_core_1 = require("@vue/compiler-core"); const utils_1 = require("../utils"); function createTransformComponentLink(name, type = 7 /* NodeTypes.DIRECTIVE */) { return function transformComponentLink(node, context) { if (!(0, utils_1.isUserComponent)(node, context)) { return; } if (type === 7 /* NodeTypes.DIRECTIVE */) { node.props.push({ type: 7 /* NodeTypes.DIRECTIVE */, name: 'on', modifiers: [], loc: compiler_core_1.locStub, arg: (0, compiler_core_1.createSimpleExpression)(name, true), exp: (0, compiler_core_1.createSimpleExpression)('__l', true), }); } else { node.props.push((0, utils_1.createAttributeNode)(name, '__l')); } }; } exports.createTransformComponentLink = createTransformComponentLink; }, function(modId) { var map = {"../utils":1745998156564}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156564, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.renameProp = exports.getBaseNodeTransforms = exports.createUniVueTransformAssetUrls = exports.createBindDirectiveNode = exports.createOnDirectiveNode = exports.createDirectiveNode = exports.addStaticClass = exports.createAttributeNode = exports.isUserComponent = exports.isVueSfcFile = exports.VUE_REF_IN_FOR = exports.VUE_REF = void 0; const shared_1 = require("@vue/shared"); const uni_shared_1 = require("@dcloudio/uni-shared"); const compiler_core_1 = require("@vue/compiler-core"); const templateTransformAssetUrl_1 = require("./transforms/templateTransformAssetUrl"); const templateTransformSrcset_1 = require("./transforms/templateTransformSrcset"); const ast_1 = require("../vite/utils/ast"); const url_1 = require("../vite/utils/url"); const constants_1 = require("../constants"); exports.VUE_REF = 'r'; exports.VUE_REF_IN_FOR = 'r-i-f'; function isVueSfcFile(id) { const { filename, query } = (0, url_1.parseVueRequest)(id); return constants_1.EXTNAME_VUE_RE.test(filename) && !query.vue; } exports.isVueSfcFile = isVueSfcFile; function isUserComponent(node, context) { return (node.type === 1 /* NodeTypes.ELEMENT */ && node.tagType === 1 /* ElementTypes.COMPONENT */ && !(0, uni_shared_1.isComponentTag)(node.tag) && !(0, compiler_core_1.isCoreComponent)(node.tag) && !context.isBuiltInComponent(node.tag)); } exports.isUserComponent = isUserComponent; function createAttributeNode(name, content) { return { type: 6 /* NodeTypes.ATTRIBUTE */, loc: compiler_core_1.locStub, name, value: { type: 2 /* NodeTypes.TEXT */, loc: compiler_core_1.locStub, content, }, }; } exports.createAttributeNode = createAttributeNode; function createClassAttribute(clazz) { return createAttributeNode('class', clazz); } function addStaticClass(node, clazz) { const classProp = node.props.find((prop) => prop.type === 6 /* NodeTypes.ATTRIBUTE */ && prop.name === 'class'); if (!classProp) { return node.props.unshift(createClassAttribute(clazz)); } if (classProp.value) { return (classProp.value.content = classProp.value.content + ' ' + clazz); } classProp.value = { type: 2 /* NodeTypes.TEXT */, loc: compiler_core_1.locStub, content: clazz, }; } exports.addStaticClass = addStaticClass; function createDirectiveNode(name, arg, exp) { return { type: 7 /* NodeTypes.DIRECTIVE */, name, modifiers: [], loc: compiler_core_1.locStub, arg: (0, compiler_core_1.createSimpleExpression)(arg, true), exp: (0, shared_1.isString)(exp) ? (0, compiler_core_1.createSimpleExpression)(exp, false) : exp, }; } exports.createDirectiveNode = createDirectiveNode; function createOnDirectiveNode(name, value) { return createDirectiveNode('on', name, value); } exports.createOnDirectiveNode = createOnDirectiveNode; function createBindDirectiveNode(name, value) { return createDirectiveNode('bind', name, value); } exports.createBindDirectiveNode = createBindDirectiveNode; function createUniVueTransformAssetUrls(base) { return { base, includeAbsolute: true, tags: { audio: ['src'], video: ['src', 'poster'], img: ['src'], image: ['src'], 'cover-image': ['src'], // h5 'v-uni-audio': ['src'], 'v-uni-video': ['src', 'poster'], 'v-uni-image': ['src'], 'v-uni-cover-image': ['src'], // nvue 'u-image': ['src'], 'u-video': ['src', 'poster'], }, }; } exports.createUniVueTransformAssetUrls = createUniVueTransformAssetUrls; function getBaseNodeTransforms(base) { const transformAssetUrls = createUniVueTransformAssetUrls(base); return [ (0, templateTransformAssetUrl_1.createAssetUrlTransformWithOptions)(transformAssetUrls), (0, templateTransformSrcset_1.createSrcsetTransformWithOptions)(transformAssetUrls), ]; } exports.getBaseNodeTransforms = getBaseNodeTransforms; function renameProp(name, prop) { if (!prop) { return; } if ((0, ast_1.isDirectiveNode)(prop)) { if (prop.arg && (0, compiler_core_1.isStaticExp)(prop.arg)) { prop.arg.content = name; } } else { prop.name = name; } } exports.renameProp = renameProp; }, function(modId) { var map = {"./transforms/templateTransformAssetUrl":1745998156565,"./transforms/templateTransformSrcset":1745998156567,"../vite/utils/ast":1745998156491,"../vite/utils/url":1745998156492,"../constants":1745998156488}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156565, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformAssetUrl = exports.createAssetUrlTransformWithOptions = exports.normalizeOptions = exports.defaultAssetUrlOptions = void 0; const path_1 = __importDefault(require("path")); const compiler_core_1 = require("@vue/compiler-core"); const templateUtils_1 = require("./templateUtils"); const shared_1 = require("@vue/shared"); exports.defaultAssetUrlOptions = { base: null, includeAbsolute: false, tags: { video: ['src', 'poster'], source: ['src'], img: ['src'], image: ['xlink:href', 'href'], use: ['xlink:href', 'href'], }, }; const normalizeOptions = (options) => { if (Object.keys(options).some((key) => (0, shared_1.isArray)(options[key]))) { // legacy option format which directly passes in tags config return { ...exports.defaultAssetUrlOptions, tags: options, }; } return { ...exports.defaultAssetUrlOptions, ...options, }; }; exports.normalizeOptions = normalizeOptions; const createAssetUrlTransformWithOptions = (options) => { return (node, context) => exports.transformAssetUrl(node, context, options); }; exports.createAssetUrlTransformWithOptions = createAssetUrlTransformWithOptions; /** * A `@vue/compiler-core` plugin that transforms relative asset urls into * either imports or absolute urls. * * ``` js * // Before * createVNode('img', { src: './logo.png' }) * * // After * import _imports_0 from './logo.png' * createVNode('img', { src: _imports_0 }) * ``` */ const transformAssetUrl = (node, context, options = exports.defaultAssetUrlOptions) => { if (node.type === 1 /* NodeTypes.ELEMENT */) { if (!node.props.length) { return; } const tags = options.tags || exports.defaultAssetUrlOptions.tags; const attrs = tags[node.tag]; const wildCardAttrs = tags['*']; if (!attrs && !wildCardAttrs) { return; } // 策略: // h5 平台保留原始策略 // 非 h5 平台 // - 绝对路径 static 资源不做转换 // - 相对路径 static 资源转换为绝对路径 // - 非 static 资源转换为 import const assetAttrs = (attrs || []).concat(wildCardAttrs || []); node.props.forEach((attr, index) => { if (attr.type !== 6 /* NodeTypes.ATTRIBUTE */ || !assetAttrs.includes(attr.name) || !attr.value || (0, templateUtils_1.isExternalUrl)(attr.value.content) || (0, templateUtils_1.isDataUrl)(attr.value.content) || attr.value.content[0] === '#') { return; } // fixed by xxxxxx 区分 static 资源 const isStaticAsset = attr.value.content.indexOf('/static/') > -1; // 绝对路径的静态资源不作处理 if (isStaticAsset && !(0, templateUtils_1.isRelativeUrl)(attr.value.content)) { return; } const url = (0, templateUtils_1.parseUrl)(attr.value.content); if (options.base && attr.value.content[0] === '.' && isStaticAsset) { // explicit base - directly rewrite relative urls into absolute url // to avoid generating extra imports // Allow for full hostnames provided in options.base const base = (0, templateUtils_1.parseUrl)(options.base); const protocol = base.protocol || ''; const host = base.host ? protocol + '//' + base.host : ''; const basePath = base.path || '/'; // when packaged in the browser, path will be using the posix- // only version provided by rollup-plugin-node-builtins. attr.value.content = host + (path_1.default.posix || path_1.default).join(basePath, url.path + (url.hash || '')); return; } // otherwise, transform the url into an import. // this assumes a bundler will resolve the import into the correct // absolute url (e.g. webpack file-loader) const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context); node.props[index] = { type: 7 /* NodeTypes.DIRECTIVE */, name: 'bind', arg: (0, compiler_core_1.createSimpleExpression)(attr.name, true, attr.loc), exp, modifiers: [], loc: attr.loc, }; }); } }; exports.transformAssetUrl = transformAssetUrl; function getImportsExpressionExp(path, hash, loc, context) { if (path) { let name; let exp; const existingIndex = context.imports.findIndex((i) => i.path === path); if (existingIndex > -1) { name = `_imports_${existingIndex}`; exp = context.imports[existingIndex].exp; } else { name = `_imports_${context.imports.length}`; exp = (0, compiler_core_1.createSimpleExpression)(name, false, loc, 2 /* ConstantTypes.CAN_HOIST */); context.imports.push({ exp, path }); } if (!hash) { return exp; } const hashExp = `${name} + '${hash}'`; const existingHoistIndex = context.hoists.findIndex((h) => { return (h && h.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && !h.isStatic && h.content === hashExp); }); if (existingHoistIndex > -1) { return (0, compiler_core_1.createSimpleExpression)(`_hoisted_${existingHoistIndex + 1}`, false, loc, 2 /* ConstantTypes.CAN_HOIST */); } return context.hoist((0, compiler_core_1.createSimpleExpression)(hashExp, false, loc, 2 /* ConstantTypes.CAN_HOIST */)); } else { return (0, compiler_core_1.createSimpleExpression)(`''`, false, loc, 2 /* ConstantTypes.CAN_HOIST */); } } }, function(modId) { var map = {"./templateUtils":1745998156566}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156566, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseUrl = exports.isDataUrl = exports.isExternalUrl = exports.isRelativeUrl = void 0; const url_1 = require("url"); const shared_1 = require("@vue/shared"); function isRelativeUrl(url) { const firstChar = url.charAt(0); return firstChar === '.' || firstChar === '~' || firstChar === '@'; } exports.isRelativeUrl = isRelativeUrl; const externalRE = /^(https?:)?\/\//; function isExternalUrl(url) { return externalRE.test(url); } exports.isExternalUrl = isExternalUrl; const dataUrlRE = /^\s*data:/i; function isDataUrl(url) { return dataUrlRE.test(url); } exports.isDataUrl = isDataUrl; /** * Parses string url into URL object. */ function parseUrl(url) { const firstChar = url.charAt(0); if (firstChar === '~') { const secondChar = url.charAt(1); url = url.slice(secondChar === '/' ? 2 : 1); } return parseUriParts(url); } exports.parseUrl = parseUrl; /** * vuejs/component-compiler-utils#22 Support uri fragment in transformed require * @param urlString an url as a string */ function parseUriParts(urlString) { // A TypeError is thrown if urlString is not a string // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost return (0, url_1.parse)((0, shared_1.isString)(urlString) ? urlString : '', false, true); } }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156567, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformSrcset = exports.createSrcsetTransformWithOptions = void 0; const path_1 = __importDefault(require("path")); const compiler_core_1 = require("@vue/compiler-core"); const templateUtils_1 = require("./templateUtils"); const templateTransformAssetUrl_1 = require("./templateTransformAssetUrl"); const srcsetTags = ['img', 'source']; // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5 const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g; const createSrcsetTransformWithOptions = (options) => { return (node, context) => exports.transformSrcset(node, context, options); }; exports.createSrcsetTransformWithOptions = createSrcsetTransformWithOptions; const transformSrcset = (node, context, options = templateTransformAssetUrl_1.defaultAssetUrlOptions) => { if (node.type === 1 /* NodeTypes.ELEMENT */) { if (srcsetTags.includes(node.tag) && node.props.length) { node.props.forEach((attr, index) => { if (attr.name === 'srcset' && attr.type === 6 /* NodeTypes.ATTRIBUTE */) { if (!attr.value) return; const value = attr.value.content; if (!value) return; const imageCandidates = value .split(',') .map((s) => { // The attribute value arrives here with all whitespace, except // normal spaces, represented by escape sequences const [url, descriptor] = s .replace(escapedSpaceCharacters, ' ') .trim() .split(' ', 2); return { url, descriptor }; }); // data urls contains comma after the ecoding so we need to re-merge // them for (let i = 0; i < imageCandidates.length; i++) { const { url } = imageCandidates[i]; if ((0, templateUtils_1.isDataUrl)(url)) { imageCandidates[i + 1].url = url + ',' + imageCandidates[i + 1].url; imageCandidates.splice(i, 1); } } const hasQualifiedUrl = imageCandidates.some(({ url }) => { return (!(0, templateUtils_1.isExternalUrl)(url) && !(0, templateUtils_1.isDataUrl)(url) && (options.includeAbsolute || (0, templateUtils_1.isRelativeUrl)(url))); }); // When srcset does not contain any qualified URLs, skip transforming if (!hasQualifiedUrl) { return; } if (options.base) { const base = options.base; const set = []; imageCandidates.forEach(({ url, descriptor }) => { descriptor = descriptor ? ` ${descriptor}` : ``; if ((0, templateUtils_1.isRelativeUrl)(url)) { set.push((path_1.default.posix || path_1.default).join(base, url) + descriptor); } else { set.push(url + descriptor); } }); attr.value.content = set.join(', '); return; } const compoundExpression = (0, compiler_core_1.createCompoundExpression)([], attr.loc); imageCandidates.forEach(({ url, descriptor }, index) => { if (!(0, templateUtils_1.isExternalUrl)(url) && !(0, templateUtils_1.isDataUrl)(url) && (options.includeAbsolute || (0, templateUtils_1.isRelativeUrl)(url))) { const { path } = (0, templateUtils_1.parseUrl)(url); let exp; if (path) { const existingImportsIndex = context.imports.findIndex((i) => i.path === path); if (existingImportsIndex > -1) { exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${existingImportsIndex}`, false, attr.loc, 2 /* ConstantTypes.CAN_HOIST */); } else { exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${context.imports.length}`, false, attr.loc, 2 /* ConstantTypes.CAN_HOIST */); context.imports.push({ exp, path }); } compoundExpression.children.push(exp); } } else { const exp = (0, compiler_core_1.createSimpleExpression)(`"${url}"`, false, attr.loc, 2 /* ConstantTypes.CAN_HOIST */); compoundExpression.children.push(exp); } const isNotLast = imageCandidates.length - 1 > index; if (descriptor && isNotLast) { compoundExpression.children.push(` + ' ${descriptor}, ' + `); } else if (descriptor) { compoundExpression.children.push(` + ' ${descriptor}'`); } else if (isNotLast) { compoundExpression.children.push(` + ', ' + `); } }); const hoisted = context.hoist(compoundExpression); hoisted.constType = 2 /* ConstantTypes.CAN_HOIST */; node.props[index] = { type: 7 /* NodeTypes.DIRECTIVE */, name: 'bind', arg: (0, compiler_core_1.createSimpleExpression)('srcset', true, attr.loc), exp: hoisted, modifiers: [], loc: attr.loc, }; } }); } } }; exports.transformSrcset = transformSrcset; }, function(modId) { var map = {"./templateUtils":1745998156566,"./templateTransformAssetUrl":1745998156565}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156568, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.transformRef = void 0; const compiler_core_1 = require("@vue/compiler-core"); const utils_1 = require("../utils"); function transformRef(node, context) { if (!(0, utils_1.isUserComponent)(node, context)) { return; } addVueRef(node, context); } exports.transformRef = transformRef; function addVueRef(node, context) { // 仅配置了 ref 属性的,才需要增补 vue-ref const refProp = (0, compiler_core_1.findProp)(node, 'ref'); if (!refProp) { return; } if (refProp.type === 6 /* NodeTypes.ATTRIBUTE */) { refProp.name = 'u-' + utils_1.VUE_REF; } else { ; refProp.arg.content = 'u-' + utils_1.VUE_REF; } return (0, utils_1.addStaticClass)(node, // ref-in-for // ref context.inVFor ? utils_1.VUE_REF_IN_FOR : utils_1.VUE_REF); } }, function(modId) { var map = {"../utils":1745998156564}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156569, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.transformPageHead = void 0; const utils_1 = require("../../utils"); const transformPageHead = (node, context) => { // 发现是page-meta下的head,直接remove该节点 (0, utils_1.checkElementNodeTag)(node, 'head') && (0, utils_1.checkElementNodeTag)(context.parent, 'page-meta') && context.removeNode(node); }; exports.transformPageHead = transformPageHead; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156571, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.STRINGIFY_JSON = exports.ATTR_DATASET_EVENT_OPTS = exports.addEventOpts = exports.createCustomEventExpr = exports.createTransformOn = exports.defaultMatch = void 0; const uni_shared_1 = require("@dcloudio/uni-shared"); const compiler_core_1 = require("@vue/compiler-core"); const utils_1 = require("../utils"); function defaultMatch(name, node, context) { return isCustomEvent(name) && (0, utils_1.isUserComponent)(node, context); } exports.defaultMatch = defaultMatch; /** * 百度、快手小程序的自定义组件,不支持动态事件绑定,故转换为静态事件 + dataset * @param baseTransformOn * @returns */ function createTransformOn(baseTransformOn, { match } = { match: defaultMatch, }) { return (dir, node, context, augmentor) => { const res = baseTransformOn(dir, node, context, augmentor); const { name, arg, exp } = dir; if (name !== 'on' || !arg || !exp || !(0, compiler_core_1.isStaticExp)(arg)) { return res; } if (!match(arg.content, node, context)) { return res; } const value = res.props[0].value; res.props[0].value = createCustomEventExpr(); addEventOpts(node.tagType === 1 /* ElementTypes.COMPONENT */ ? (0, uni_shared_1.customizeEvent)(arg.content) : arg.content, value, node, context); return res; }; } exports.createTransformOn = createTransformOn; function createCustomEventExpr() { return (0, compiler_core_1.createSimpleExpression)('__e', true); } exports.createCustomEventExpr = createCustomEventExpr; function addEventOpts(event, value, node, context) { const attrName = node.tagType === 1 /* ElementTypes.COMPONENT */ ? ATTR_DATA_EVENT_OPTS : exports.ATTR_DATASET_EVENT_OPTS; const opts = (0, compiler_core_1.findProp)(node, attrName, true); if (!opts) { node.props.push(createDataEventOptsProp(attrName, event, value, context)); } else { const children = opts.exp.children; children.splice(children.length - 2, 0, createDataEventOptsProperty(event, value)); } } exports.addEventOpts = addEventOpts; const ATTR_DATA_EVENT_OPTS = 'eO'; exports.ATTR_DATASET_EVENT_OPTS = 'data-e-o'; function createDataEventOptsProperty(event, exp) { return (0, compiler_core_1.createCompoundExpression)([`'${event}'`, ': ', exp, ',']); } exports.STRINGIFY_JSON = Symbol(`stringifyJson`); function createDataEventOptsProp(name, event, exp, context) { const children = []; const stringify = name === ATTR_DATA_EVENT_OPTS; if (stringify) { children.push(context.helperString(exports.STRINGIFY_JSON) + '('); } children.push('{', createDataEventOptsProperty(event, exp), '}'); if (stringify) { children.push(')'); } return { type: 7 /* NodeTypes.DIRECTIVE */, name: 'bind', loc: compiler_core_1.locStub, modifiers: [], arg: (0, compiler_core_1.createSimpleExpression)(name, true), exp: (0, compiler_core_1.createCompoundExpression)(children), }; } const builtInEvents = [ '__l', 'tap', 'longtap', 'longpress', 'touchstart', 'touchmove', 'touchcancel', 'touchend', 'touchforcechange', 'transitionend', 'animationstart', 'animationiteration', 'animationend', ]; function isCustomEvent(name) { return !builtInEvents.includes(name); } }, function(modId) { var map = {"../utils":1745998156564}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156572, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createTransformModel = exports.defaultMatch = void 0; const utils_1 = require("../utils"); const vOn_1 = require("./vOn"); function defaultMatch(node, context) { return (0, utils_1.isUserComponent)(node, context); } exports.defaultMatch = defaultMatch; /** * 百度、快手小程序的自定义组件,不支持动态事件绑定,故 v-model 也需要调整 * @param baseTransformModel * @returns */ function createTransformModel(baseTransformModel, { match } = { match: defaultMatch, }) { return (dir, node, context, augmentor) => { const res = baseTransformModel(dir, node, context, augmentor); if (!match(node, context)) { return res; } const props = res.props; if (props[1]) { // input,textarea 的 v-model 事件可能会被合并到已有的 input 中 const { arg, exp } = props[1]; (0, vOn_1.addEventOpts)(arg.content, exp, node, context); props[1].exp = (0, vOn_1.createCustomEventExpr)(); } return res; }; } exports.createTransformModel = createTransformModel; }, function(modId) { var map = {"../utils":1745998156564,"./vOn":1745998156571}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156573, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseWxsCode = exports.parseWxsNodes = exports.parseBlockCode = exports.parseVueCode = void 0; const magic_string_1 = __importDefault(require("magic-string")); const ast_1 = require("../vite/utils/ast"); const BLOCK_RE = /<\/block>/; const WXS_LANG_RE = /lang=["|'](renderjs|wxs|sjs)["|']/; const WXS_ATTRS = ['wxs', 'renderjs', 'sjs']; function parseVueCode(code, isNVue = false) { const hasBlock = BLOCK_RE.test(code); const hasWxs = WXS_LANG_RE.test(code); if (!hasBlock && !hasWxs) { return { code }; } const errors = []; const files = []; let ast = (0, ast_1.parseVue)(code, errors); if (hasBlock) { code = parseBlockCode(ast, code); // 重新解析新的 code ast = (0, ast_1.parseVue)(code, errors); } if (!isNVue && hasWxs) { const wxsNodes = parseWxsNodes(ast); code = parseWxsCode(wxsNodes, code); // add watch for (const wxsNode of wxsNodes) { const srcProp = wxsNode.props.find((prop) => prop.type === 6 /* NodeTypes.ATTRIBUTE */ && prop.name === 'src'); if (srcProp && srcProp.value) { files.push(srcProp.value.content); } } } return { code, files, errors }; } exports.parseVueCode = parseVueCode; function traverseChildren({ children }, blockNodes) { children.forEach((node) => traverseNode(node, blockNodes)); } function traverseNode(node, blockNodes) { if ((0, ast_1.isElementNode)(node) && node.tag === 'block') { blockNodes.push(node); } if (node.type === 10 /* NodeTypes.IF_BRANCH */ || node.type === 11 /* NodeTypes.FOR */ || node.type === 1 /* NodeTypes.ELEMENT */ || node.type === 0 /* NodeTypes.ROOT */) { traverseChildren(node, blockNodes); } } function parseBlockCode(ast, code) { const blockNodes = []; traverseNode(ast, blockNodes); if (blockNodes.length) { return parseBlockNode(code, blockNodes); } return code; } exports.parseBlockCode = parseBlockCode; const BLOCK_END_LEN = ''.length; const BLOCK_START_LEN = ' { const startOffset = loc.start.offset; const endOffset = loc.end.offset; magicString.overwrite(startOffset, startOffset + BLOCK_START_LEN, ''); }); return magicString.toString(); } function parseWxsNodes(ast) { return ast.children.filter((node) => node.type === 1 /* NodeTypes.ELEMENT */ && node.tag === 'script' && node.props.find((prop) => prop.name === 'lang' && prop.type === 6 /* NodeTypes.ATTRIBUTE */ && prop.value && WXS_ATTRS.includes(prop.value.content))); } exports.parseWxsNodes = parseWxsNodes; function parseWxsCode(wxsNodes, code) { if (wxsNodes.length) { code = parseWxsNode(code, wxsNodes); } return code; } exports.parseWxsCode = parseWxsCode; const SCRIPT_END_LEN = ''.length; const SCRIPT_START_LEN = ' { const langAttr = props.find((prop) => prop.name === 'lang'); const moduleAttr = props.find((prop) => prop.name === 'module'); const startOffset = loc.start.offset; const endOffset = loc.end.offset; const lang = langAttr.value.content; const langStartOffset = langAttr.loc.start.offset; magicString.overwrite(startOffset, startOffset + SCRIPT_START_LEN, '<' + lang); // '); // or if (moduleAttr) { const moduleStartOffset = moduleAttr.loc.start.offset; magicString.overwrite(moduleStartOffset, moduleStartOffset + 'module'.length, 'name'); // module="echarts" => name="echarts" } }); return magicString.toString(); } }, function(modId) { var map = {"../vite/utils/ast":1745998156491}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156574, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.transformUniH5Jsx = void 0; const uni_shared_1 = require("@dcloudio/uni-shared"); function transformUniH5Jsx({ types }) { return { name: 'babel-plugin-uni-h5-jsx', visitor: { JSXOpeningElement({ node: { name } }) { if (types.isJSXIdentifier(name) && (0, uni_shared_1.isBuiltInComponent)(name.name)) { name.name = 'v-uni-' + name.name; } }, }, }; } exports.transformUniH5Jsx = transformUniH5Jsx; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156575, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const fast_glob_1 = __importDefault(require("fast-glob")); const shared_1 = require("@vue/shared"); const hbx_1 = require("./hbx"); const utils_1 = require("./utils"); const uni_shared_1 = require("@dcloudio/uni-shared"); const uni_modules_1 = require("./uni_modules"); /** * 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可 * @param id * @param importer * @returns */ function resolveUTSAppModule(id, importer, includeUTSSDK = true) { id = path_1.default.resolve(importer, id); if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) { const parts = (0, utils_1.normalizePath)(id).split('/'); const parentDir = parts[parts.length - 2]; if (parentDir === 'uni_modules' || (includeUTSSDK && parentDir === 'utssdk')) { const basedir = parentDir === 'uni_modules' ? 'utssdk' : ''; if (fs_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) { return id; } const resolvePlatformDir = (p) => { return path_1.default.resolve(id, basedir, p); }; const extname = ['.uts']; if (resolveUTSFile(resolvePlatformDir('app-android'), extname)) { return id; } if (resolveUTSFile(resolvePlatformDir('app-ios'), extname)) { return id; } } } } exports.resolveUTSAppModule = resolveUTSAppModule; // 仅限 root/uni_modules/test-plugin | root/utssdk/test-plugin 格式 function resolveUTSModule(id, importer, includeUTSSDK = true) { if (process.env.UNI_PLATFORM === 'app' || process.env.UNI_PLATFORM === 'app-plus') { return resolveUTSAppModule(id, importer); } id = path_1.default.resolve(importer, id); if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) { const parts = (0, utils_1.normalizePath)(id).split('/'); const parentDir = parts[parts.length - 2]; if (parentDir === 'uni_modules' || (includeUTSSDK && parentDir === 'utssdk')) { const basedir = parentDir === 'uni_modules' ? 'utssdk' : ''; const resolvePlatformDir = (p) => { return path_1.default.resolve(id, basedir, p); }; let index = resolveUTSFile(resolvePlatformDir(process.env.UNI_UTS_PLATFORM)); if (index) { return index; } index = path_1.default.resolve(id, basedir, 'index.uts'); if (fs_1.default.existsSync(index)) { return index; } } } } exports.resolveUTSModule = resolveUTSModule; function resolveUTSFile(dir, extensions = ['.uts', '.ts', '.js']) { for (let i = 0; i < extensions.length; i++) { const indexFile = path_1.default.join(dir, 'index' + extensions[i]); if (fs_1.default.existsSync(indexFile)) { return indexFile; } } } function resolveUTSCompiler() { let compilerPath = ''; if ((0, hbx_1.isInHBuilderX)()) { try { compilerPath = require.resolve(path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'uniapp-uts-v1')); } catch (e) { } } if (!compilerPath) { try { compilerPath = require.resolve('@dcloudio/uni-uts-v1', { paths: [process.env.UNI_CLI_CONTEXT], }); } catch (e) { let utsCompilerVersion = utils_1.version; if (utils_1.version.startsWith('2.0.')) { utsCompilerVersion = '^3.0.0-alpha-3060920221117001'; } console.error((0, utils_1.installDepTips)('devDependencies', '@dcloudio/uni-uts-v1', utsCompilerVersion)); process.exit(0); } } return require(compilerPath); } exports.resolveUTSCompiler = resolveUTSCompiler; const utsComponents = new Map(); function isUTSComponent(name) { return utsComponents.has(name); } exports.isUTSComponent = isUTSComponent; function parseUTSComponent(name, type) { const meta = utsComponents.get(name); if (meta) { const namespace = meta[type === 'swift' ? 'swiftModule' : 'kotlinPackage'] || ''; const className = (0, shared_1.capitalize)((0, shared_1.camelize)(name)) + 'Component'; return { className, namespace, source: meta.source, }; } } exports.parseUTSComponent = parseUTSComponent; function initUTSComponents(inputDir, platform) { utsComponents.clear(); const components = []; if (platform !== 'app' && platform !== 'app-plus') { return components; } const easycomsObj = {}; const dirs = resolveUTSComponentDirs(inputDir); dirs.forEach((dir) => { const is_uni_modules_utssdk = dir.endsWith('utssdk'); const is_ussdk = !is_uni_modules_utssdk && path_1.default.dirname(dir).endsWith('utssdk'); const pluginId = is_uni_modules_utssdk ? path_1.default.basename(path_1.default.dirname(dir)) : path_1.default.basename(dir); if (is_uni_modules_utssdk || is_ussdk) { fast_glob_1.default .sync('**/*.vue', { cwd: dir, absolute: true, }) .forEach((file) => { let name = parseVueComponentName(file); if (!name) { if (file.endsWith('index.vue')) { name = path_1.default.basename(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir); } } if (name) { const importDir = (0, utils_1.normalizePath)(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir); easycomsObj[`^${name}$`] = { source: `${importDir}?uts-proxy`, kotlinPackage: parseKotlinPackageWithPluginId(pluginId, is_uni_modules_utssdk), swiftModule: parseSwiftPackageWithPluginId(pluginId, is_uni_modules_utssdk), }; } }); } }); Object.keys(easycomsObj).forEach((name) => { const obj = easycomsObj[name]; const componentName = name.slice(1, -1); components.push({ name: componentName, pattern: new RegExp(name), replacement: obj.source, }); utsComponents.set(componentName, { source: obj.source, kotlinPackage: obj.kotlinPackage, swiftModule: obj.swiftModule, }); }); return components; } exports.initUTSComponents = initUTSComponents; function resolveUTSComponentDirs(inputDir) { const utssdkDir = path_1.default.resolve(inputDir, 'utssdk'); const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules'); return fast_glob_1.default .sync('*', { cwd: utssdkDir, absolute: true, onlyDirectories: true, }) .concat(fast_glob_1.default.sync('*/utssdk', { cwd: uniModulesDir, absolute: true, onlyDirectories: true, })); } const nameRE = /name\s*:\s*['|"](.*)['|"]/; function parseVueComponentName(file) { const content = fs_1.default.readFileSync(file, 'utf8'); const matches = content.match(nameRE); if (matches) { return matches[1]; } } function prefix(id) { if (process.env.UNI_UTS_MODULE_PREFIX && !id.startsWith(process.env.UNI_UTS_MODULE_PREFIX)) { return process.env.UNI_UTS_MODULE_PREFIX + '-' + id; } return id; } function parseKotlinPackageWithPluginId(id, is_uni_modules) { return 'uts.sdk.' + (is_uni_modules ? 'modules.' : '') + (0, shared_1.camelize)(prefix(id)); } exports.parseKotlinPackageWithPluginId = parseKotlinPackageWithPluginId; function parseSwiftPackageWithPluginId(id, is_uni_modules) { return ('UTSSDK' + (is_uni_modules ? 'Modules' : '') + (0, shared_1.capitalize)((0, shared_1.camelize)(prefix(id)))); } exports.parseSwiftPackageWithPluginId = parseSwiftPackageWithPluginId; exports.parseUniExtApiNamespacesOnce = (0, uni_shared_1.once)((platform, language) => { const extApis = (0, exports.parseUniExtApiNamespacesJsOnce)(platform, language); const namespaces = {}; Object.keys(extApis).forEach((name) => { const options = extApis[name]; let source = options[0]; const pluginId = path_1.default.basename(options[0]); if (language === 'kotlin') { source = parseKotlinPackageWithPluginId(pluginId, true); } else if (language === 'swift') { source = parseSwiftPackageWithPluginId(pluginId, true); } namespaces[name] = [source, options[1]]; }); return namespaces; }); exports.parseUniExtApiNamespacesJsOnce = (0, uni_shared_1.once)((platform, language) => { const extApis = (0, uni_modules_1.parseUniExtApis)(true, platform, language); const namespaces = {}; Object.keys(extApis).forEach((name) => { const options = extApis[name]; if ((0, shared_1.isArray)(options) && options.length >= 2) { namespaces[name.replace('uni.', '')] = [options[0], options[1]]; } }); return namespaces; }); }, function(modId) { var map = {"fs":1745998156463,"./hbx":1745998156551}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156578, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.COMPONENT_DEPS_CSS = exports.API_DEPS_CSS = void 0; const constants_1 = require("./constants"); const RESIZE_SENSOR_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'resize-sensor.css'; exports.API_DEPS_CSS = { showModal: [`${constants_1.H5_API_STYLE_PATH}modal.css`], showToast: [`${constants_1.H5_API_STYLE_PATH}toast.css`], showActionSheet: [`${constants_1.H5_API_STYLE_PATH}action-sheet.css`], previewImage: [ RESIZE_SENSOR_CSS, `${constants_1.BASE_COMPONENTS_STYLE_PATH}swiper.css`, `${constants_1.BASE_COMPONENTS_STYLE_PATH}swiper-item.css`, `${constants_1.BASE_COMPONENTS_STYLE_PATH}movable-area.css`, `${constants_1.BASE_COMPONENTS_STYLE_PATH}movable-view.css`, ], openLocation: [`${constants_1.H5_API_STYLE_PATH}location-view.css`], chooseLocation: [ `${constants_1.H5_API_STYLE_PATH}/location-picker.css`, `${constants_1.BASE_COMPONENTS_STYLE_PATH}/input.css`, `${constants_1.H5_COMPONENTS_STYLE_PATH}/map.css`, `${constants_1.BASE_COMPONENTS_STYLE_PATH}/scroll-view.css`, ], }; exports.COMPONENT_DEPS_CSS = { canvas: [RESIZE_SENSOR_CSS], image: [RESIZE_SENSOR_CSS], 'movable-area': [RESIZE_SENSOR_CSS], 'picker-view': [RESIZE_SENSOR_CSS], 'picker-view-column': [RESIZE_SENSOR_CSS], 'rich-text': [RESIZE_SENSOR_CSS], textarea: [RESIZE_SENSOR_CSS], 'web-view': [RESIZE_SENSOR_CSS], picker: [ RESIZE_SENSOR_CSS, `${constants_1.BASE_COMPONENTS_STYLE_PATH}picker-view.css`, `${constants_1.BASE_COMPONENTS_STYLE_PATH}picker-view-column.css`, ], }; }, function(modId) { var map = {"./constants":1745998156488}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156579, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.cssTarget = void 0; exports.cssTarget = 'chrome53'; __exportStar(require("./utils"), exports); __exportStar(require("./plugins"), exports); __exportStar(require("./features"), exports); }, function(modId) { var map = {"./utils":1745998156490,"./plugins":1745998156580,"./features":1745998156595}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156580, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateCodeFrame = exports.commonjsProxyRE = exports.cssLangRE = exports.minifyCSS = exports.cssPostPlugin = exports.cssPlugin = exports.isCSSRequest = exports.getAssetHash = exports.assetPlugin = void 0; __exportStar(require("./cssScoped"), exports); __exportStar(require("./copy"), exports); __exportStar(require("./inject"), exports); __exportStar(require("./mainJs"), exports); __exportStar(require("./jsonJs"), exports); __exportStar(require("./console"), exports); __exportStar(require("./dynamicImportPolyfill"), exports); __exportStar(require("./utsPlugin"), exports); var asset_1 = require("./vitejs/plugins/asset"); Object.defineProperty(exports, "assetPlugin", { enumerable: true, get: function () { return asset_1.assetPlugin; } }); Object.defineProperty(exports, "getAssetHash", { enumerable: true, get: function () { return asset_1.getAssetHash; } }); var css_1 = require("./vitejs/plugins/css"); Object.defineProperty(exports, "isCSSRequest", { enumerable: true, get: function () { return css_1.isCSSRequest; } }); Object.defineProperty(exports, "cssPlugin", { enumerable: true, get: function () { return css_1.cssPlugin; } }); Object.defineProperty(exports, "cssPostPlugin", { enumerable: true, get: function () { return css_1.cssPostPlugin; } }); Object.defineProperty(exports, "minifyCSS", { enumerable: true, get: function () { return css_1.minifyCSS; } }); Object.defineProperty(exports, "cssLangRE", { enumerable: true, get: function () { return css_1.cssLangRE; } }); Object.defineProperty(exports, "commonjsProxyRE", { enumerable: true, get: function () { return css_1.commonjsProxyRE; } }); var utils_1 = require("./vitejs/utils"); Object.defineProperty(exports, "generateCodeFrame", { enumerable: true, get: function () { return utils_1.generateCodeFrame; } }); }, function(modId) { var map = {"./cssScoped":1745998156581,"./copy":1745998156582,"./inject":1745998156585,"./mainJs":1745998156586,"./jsonJs":1745998156588,"./console":1745998156553,"./dynamicImportPolyfill":1745998156590,"./utsPlugin":1745998156591}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156581, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.uniCssScopedPlugin = exports.uniRemoveCssScopedPlugin = exports.addScoped = void 0; const path_1 = __importDefault(require("path")); const debug_1 = __importDefault(require("debug")); const constants_1 = require("../../constants"); const preprocess_1 = require("../../preprocess"); const parse_1 = require("../../vue/parse"); const debugScoped = (0, debug_1.default)('uni:scoped'); const SCOPED_RE = /]*scoped[^>]*>/i; function addScoped(code) { return code.replace(/(<]*)>/gi, (str, $1) => { if ($1.includes('scoped')) { return str; } return `${$1} scoped>`; }); } exports.addScoped = addScoped; function removeScoped(code) { if (!SCOPED_RE.test(code)) { return code; } return code.replace(/()/gi, '$1$2'); } function uniRemoveCssScopedPlugin({ filter } = { filter: () => false }) { return { name: 'uni:css-remove-scoped', enforce: 'pre', transform(code, id) { if (!filter(id)) return null; debugScoped(id); return { code: removeScoped(code), map: null, }; }, }; } exports.uniRemoveCssScopedPlugin = uniRemoveCssScopedPlugin; function uniCssScopedPlugin({ filter } = { filter: () => false }) { return { name: 'uni:css-scoped', enforce: 'pre', transform(code, id) { if (!filter(id)) return null; debugScoped(id); return { code: addScoped(code), map: null, }; }, // 仅 h5 handleHotUpdate(ctx) { if (!constants_1.EXTNAME_VUE.includes(path_1.default.extname(ctx.file))) { return; } const scoped = !ctx.file.endsWith('App.vue'); debugScoped('hmr', ctx.file); const oldRead = ctx.read; ctx.read = async () => { let code = await oldRead(); // hotUpdate preprocess if (code.includes('#endif')) { code = (0, preprocess_1.preJs)((0, preprocess_1.preHtml)(code)); } if (scoped) { code = addScoped(code); } // 处理 block, wxs 等 return (0, parse_1.parseVueCode)(code).code; }; }, }; } exports.uniCssScopedPlugin = uniCssScopedPlugin; }, function(modId) { var map = {"../../constants":1745998156488,"../../preprocess":1745998156481,"../../vue/parse":1745998156573}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156582, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.uniViteCopyPlugin = void 0; const watcher_1 = require("../../watcher"); const messages_1 = require("../../messages"); const logs_1 = require("../../logs"); function uniViteCopyPlugin({ targets, verbose, }) { let resolvedConfig; let initialized = false; return { name: 'uni:copy', apply: 'build', configResolved(config) { resolvedConfig = config; }, writeBundle() { if (initialized) { return; } if (resolvedConfig.build.ssr) { return; } initialized = true; return new Promise((resolve) => { Promise.all(targets.map(({ watchOptions, ...target }) => { return new Promise((resolve) => { new watcher_1.FileWatcher({ verbose, ...target, }).watch({ cwd: process.env.UNI_INPUT_DIR, ...watchOptions, }, (watcher) => { if (process.env.NODE_ENV !== 'development') { // 生产模式下,延迟 close,否则会影响 chokidar 初始化的 add 等事件 setTimeout(() => { watcher.close().then(() => resolve(void 0)); }, 2000); } else { resolve(void 0); } }, () => { // TODO 目前初始化编译时,也会不停地触发此函数。 (0, logs_1.output)('log', messages_1.M['dev.watching.end']); }); }); })).then(() => resolve()); }); }, }; } exports.uniViteCopyPlugin = uniViteCopyPlugin; }, function(modId) { var map = {"../../watcher":1745998156583,"../../messages":1745998156485,"../../logs":1745998156473}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156583, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileWatcher = void 0; const fs_extra_1 = __importDefault(require("fs-extra")); const path_1 = __importDefault(require("path")); const chokidar_1 = require("chokidar"); const shared_1 = require("@vue/shared"); const utils_1 = require("./utils"); class FileWatcher { constructor({ src, dest, transform, verbose }) { this.src = !(0, shared_1.isArray)(src) ? [src] : src; this.dest = dest; this.transform = transform; this.verbose = verbose; } watch(watchOptions, onReady, onChange) { if (!this.watcher) { const copy = this.copy.bind(this); const remove = this.remove.bind(this); // escape chokidar cwd const src = this.src.map((src) => (0, utils_1.pathToGlob)(path_1.default.resolve(watchOptions.cwd), src)); this.watcher = (0, chokidar_1.watch)(src, watchOptions) .on('add', copy) .on('addDir', copy) .on('change', copy) .on('unlink', remove) .on('unlinkDir', remove) .on('ready', () => { onReady && onReady(this.watcher); setTimeout(() => { this.onChange = onChange; }, 1000); }) .on('error', (e) => console.error('watch', e)); } return this.watcher; } add(paths) { this.info('add', paths); return this.watcher.add(paths); } unwatch(paths) { this.info('unwatch', paths); return this.watcher.unwatch(paths); } close() { this.info('close'); return this.watcher.close(); } copy(from) { const to = this.to(from); this.info('copy', from + '=>' + to); let content; if (this.transform) { const filename = this.from(from); content = this.transform(fs_extra_1.default.readFileSync(filename), filename); } if (content) { return fs_extra_1.default .outputFile(to, content) .catch(() => { // this.info('copy', e) }) .then(() => this.onChange && this.onChange()); } return fs_extra_1.default .copy(this.from(from), to, { overwrite: true }) .catch(() => { // this.info('copy', e) }) .then(() => this.onChange && this.onChange()); } remove(from) { const to = this.to(from); this.info('remove', from + '=>' + to); return fs_extra_1.default .remove(to) .catch(() => { // this.info('remove', e) }) .then(() => this.onChange && this.onChange()); } info(type, msg) { this.verbose && console.log(type, msg); } from(from) { return path_1.default.join(this.watcher.options.cwd, from); } to(from) { return path_1.default.join(this.dest, from); } } exports.FileWatcher = FileWatcher; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156585, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.uniViteInjectPlugin = void 0; const path_1 = require("path"); const debug_1 = __importDefault(require("debug")); const pluginutils_1 = require("@rollup/pluginutils"); const estree_walker_1 = require("estree-walker"); const shared_1 = require("@vue/shared"); const magic_string_1 = __importDefault(require("magic-string")); const utils_1 = require("../utils"); const debugInject = (0, debug_1.default)('uni:inject'); const debugInjectTry = (0, debug_1.default)('uni:inject-try'); function uniViteInjectPlugin(name, options) { if (!options) throw new Error('Missing options'); const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude); const modules = (0, shared_1.extend)({}, options); delete modules.include; delete modules.exclude; delete modules.sourceMap; delete modules.callback; const reassignments = new Set(); const modulesMap = new Map(); const namespaceModulesMap = new Map(); Object.keys(modules).forEach((name) => { if (name.endsWith('.')) { namespaceModulesMap.set(name, modules[name]); } modulesMap.set(name, modules[name]); }); const hasNamespace = namespaceModulesMap.size > 0; // Fix paths on Windows if (path_1.sep !== '/') { normalizeModulesMap(modulesMap); normalizeModulesMap(namespaceModulesMap); } const firstpass = new RegExp(`(?:${Array.from(modulesMap.keys()).map(escape).join('|')})`, 'g'); const sourceMap = options.sourceMap !== false; const callback = options.callback; return { name, // 确保在 commonjs 之后,否则会混合 es6 module 与 cjs 的代码,导致 commonjs 失效 enforce: 'post', transform(code, id) { if (!filter(id)) return null; if (!(0, utils_1.isJsFile)(id)) return null; debugInjectTry(id); if (code.search(firstpass) === -1) return null; if (path_1.sep !== '/') id = id.split(path_1.sep).join('/'); const ast = this.parse(code); const imports = new Set(); ast.body.forEach((node) => { if (node.type === 'ImportDeclaration') { node.specifiers.forEach((specifier) => { imports.add(specifier.local.name); }); } }); // analyse scopes let scope = (0, pluginutils_1.attachScopes)(ast, 'scope'); const magicString = new magic_string_1.default(code); const newImports = new Map(); function handleReference(node, name, keypath, parent) { let mod = modulesMap.get(keypath); if (!mod && hasNamespace) { const mods = keypath.split('.'); if (mods.length === 2) { mod = namespaceModulesMap.get(mods[0] + '.'); if (mod) { if ((0, shared_1.isArray)(mod)) { const testFn = mod[1]; if (testFn(mods[1])) { mod = [mod[0], mods[1]]; } else { mod = undefined; } } else { mod = [mod, mods[1]]; } } } } if (mod && !imports.has(name) && !scope.contains(name)) { if ((0, shared_1.isString)(mod)) mod = [mod, 'default']; if (mod[0] === id) return false; const hash = `${keypath}:${mod[0]}:${mod[1]}`; // 当 API 被覆盖定义后,不再摇树 if (reassignments.has(hash)) { return false; } if (parent && (0, utils_1.isAssignmentExpression)(parent) && parent.left === node) { reassignments.add(hash); return false; } const importLocalName = name === keypath ? name : (0, pluginutils_1.makeLegalIdentifier)(`$inject_${keypath}`); if (!newImports.has(hash)) { if (mod[1] === '*') { newImports.set(hash, `import * as ${importLocalName} from '${mod[0]}';`); } else { newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${mod[0]}';`); callback && callback(newImports, mod); } } if (name !== keypath) { magicString.overwrite(node.start, node.end, importLocalName, { storeName: true, }); } return true; } return false; } (0, estree_walker_1.walk)(ast, { enter(node, parent) { if (sourceMap) { magicString.addSourcemapLocation(node.start); magicString.addSourcemapLocation(node.end); } if (node.scope) { scope = node.scope; } if ((0, utils_1.isProperty)(node) && node.shorthand) { const { name } = node.key; handleReference(node, name, name); this.skip(); return; } if ((0, utils_1.isReference)(node, parent)) { const { name, keypath } = flatten(node); const handled = handleReference(node, name, keypath, parent); if (handled) { this.skip(); } } }, leave(node) { if (node.scope) { scope = scope.parent; } }, }); debugInject(id, newImports.size); if (newImports.size === 0) { return { code, // 不能返回 ast ,否则会导致代码不能被再次修改 // 比如 App.vue 中,console.log('uniCloud') 触发了 inject 检测,检测完,发现不需要 // 此时返回 ast,会导致 import { setupApp } from '@dcloudio/uni-h5' 不会被编译 // ast map: null, }; } const importBlock = Array.from(newImports.values()).join('\n\n'); magicString.prepend(`${importBlock}\n\n`); return { code: magicString.toString(), map: sourceMap ? magicString.generateMap({ hires: true }) : null, }; }, }; } exports.uniViteInjectPlugin = uniViteInjectPlugin; const escape = (str) => str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&'); const flatten = (startNode) => { const parts = []; let node = startNode; while ((0, utils_1.isMemberExpression)(node)) { parts.unshift(node.property.name); node = node.object; } const { name } = node; parts.unshift(name); return { name, keypath: parts.join('.') }; }; function normalizeModulesMap(modulesMap) { modulesMap.forEach((mod, key) => { modulesMap.set(key, (0, shared_1.isArray)(mod) ? [mod[0].split(path_1.sep).join('/'), mod[1]] : mod.split(path_1.sep).join('/')); }); } }, function(modId) { var map = {"../utils":1745998156490}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156586, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.defineUniMainJsPlugin = void 0; const path_1 = __importDefault(require("path")); const utils_1 = require("../../utils"); function defineUniMainJsPlugin(createUniMainJsPlugin) { const opts = { resolvedConfig: {}, filter(id) { return id === mainJsPath || id === mainTsPath || id === mainUTsPath; }, }; const plugin = createUniMainJsPlugin(opts); const origConfigResolved = plugin.configResolved; let mainJsPath = ''; let mainTsPath = ''; let mainUTsPath = ''; plugin.configResolved = function (config) { opts.resolvedConfig = config; const mainPath = (0, utils_1.normalizePath)(path_1.default.resolve(process.env.UNI_INPUT_DIR, 'main')); mainJsPath = mainPath + '.js'; mainTsPath = mainPath + '.ts'; mainUTsPath = mainPath + '.uts'; return origConfigResolved && origConfigResolved(config); }; return plugin; } exports.defineUniMainJsPlugin = defineUniMainJsPlugin; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156588, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.defineUniManifestJsonPlugin = exports.defineUniPagesJsonPlugin = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const constants_1 = require("../../constants"); const utils_1 = require("../../utils"); exports.defineUniPagesJsonPlugin = createDefineJsonJsPlugin('pages.json'); exports.defineUniManifestJsonPlugin = createDefineJsonJsPlugin('manifest.json'); function createDefineJsonJsPlugin(name) { const JSON_JS = constants_1.JSON_JS_MAP[name]; return function (createVitePlugin) { const opts = { resolvedConfig: {}, filter(id) { return id.endsWith(JSON_JS); }, }; const plugin = createVitePlugin(opts); const origLoad = plugin.load; const origResolveId = plugin.resolveId; const origConfigResolved = plugin.configResolved; let jsonPath = ''; let jsonJsPath = ''; plugin.resolveId = function (id, importer, options) { const res = origResolveId && origResolveId.call(this, id, importer, options); if (res) { return res; } if (id.endsWith(JSON_JS)) { return jsonJsPath; } }; plugin.configResolved = function (config) { opts.resolvedConfig = config; jsonPath = (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, name)); jsonJsPath = (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, JSON_JS)); return origConfigResolved && origConfigResolved(config); }; plugin.load = function (id, ssr) { const res = origLoad && origLoad.call(this, id, ssr); if (res) { return res; } if (!opts.filter(id)) { return; } return fs_1.default.readFileSync(jsonPath, 'utf8'); }; return plugin; }; } }, function(modId) { var map = {"../../constants":1745998156488}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156590, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.dynamicImportPolyfill = void 0; function dynamicImportPolyfill(promise = false) { return { name: 'dynamic-import-polyfill', renderDynamicImport() { return { left: promise ? 'Promise.resolve(' : '(', right: ')', }; }, }; } exports.dynamicImportPolyfill = dynamicImportPolyfill; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156591, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.uniUTSPlugin = exports.utsPlugins = void 0; const path_1 = __importDefault(require("path")); const uni_shared_1 = require("@dcloudio/uni-shared"); const uts_1 = require("../../uts"); const utils_1 = require("../utils"); const UTSProxyRE = /\?uts-proxy$/; function isUTSProxy(id) { return UTSProxyRE.test(id); } const utsModuleCaches = new Map(); exports.utsPlugins = new Set(); function uniUTSPlugin(options = {}) { process.env.UNI_UTS_USING_ROLLUP = 'true'; return { name: 'uni:uts', apply: 'build', enforce: 'pre', resolveId(id, importer) { if (isUTSProxy(id)) { return id; } const module = (0, uts_1.resolveUTSAppModule)(id, importer ? path_1.default.dirname(importer) : process.env.UNI_INPUT_DIR, options.x !== true); if (module) { // prefix the polyfill id with \0 to tell other plugins not to try to load or transform it return module + '?uts-proxy'; } }, load(id) { if (isUTSProxy(id)) { return ''; } }, buildEnd() { utsModuleCaches.clear(); }, async transform(_, id, opts) { if (opts && opts.ssr) { return; } if (!isUTSProxy(id)) { return; } const { filename: pluginDir } = (0, utils_1.parseVueRequest)(id.replace('\0', '')); // 当 vue 和 nvue 均引用了相同 uts 插件,解决两套编译器会编译两次 uts 插件的问题 // 通过缓存,保证同一个 uts 插件只编译一次 if (utsModuleCaches.get(pluginDir)) { return utsModuleCaches.get(pluginDir)().then((result) => { if (result) { result.deps.forEach((dep) => { this.addWatchFile(dep); }); return { code: result.code, syntheticNamedExports: result.encrypt, meta: result.meta, }; } }); } const compile = (0, uni_shared_1.once)(() => { exports.utsPlugins.add(path_1.default.basename(pluginDir)); return (0, uts_1.resolveUTSCompiler)().compile(pluginDir, { isX: !!options.x, isPlugin: true, extApis: options.extApis, }); }); utsModuleCaches.set(pluginDir, compile); const result = await compile(); if (result) { result.deps.forEach((dep) => { this.addWatchFile(dep); }); return { code: result.code, syntheticNamedExports: result.encrypt, meta: result.meta, }; } }, }; } exports.uniUTSPlugin = uniUTSPlugin; }, function(modId) { var map = {"../../uts":1745998156575,"../utils":1745998156490}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156595, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.initFeatures = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const shared_1 = require("@vue/shared"); function initProjectFeature({ inputDir }) { const features = { i18nLocale: false, i18nEn: true, i18nEs: true, i18nFr: true, i18nZhHans: true, i18nZhHant: true, uniCloud: false, }; const localesDir = path_1.default.resolve(inputDir, 'locale'); if (fs_1.default.existsSync(localesDir)) { if (fs_1.default.readdirSync(localesDir).find((file) => path_1.default.extname(file) === '.json')) { features.i18nLocale = true; } } if (process.env.UNI_CLOUD_PROVIDER) { try { const providers = JSON.parse(process.env.UNI_CLOUD_PROVIDER); if (providers.length) { features.uniCloud = true; } } catch (e) { } } return features; } function initPagesFeature({ pagesJson, command, inputDir, ssr, }) { const features = { nvue: true, pages: true, tabBar: true, tabBarMidButton: true, topWindow: false, leftWindow: false, rightWindow: false, navigationBar: true, pullDownRefresh: false, navigationBarButtons: true, navigationBarSearchInput: true, navigationBarTransparent: true, }; const { tabBar, pages, topWindow, leftWindow, rightWindow, globalStyle } = pagesJson; // ssr 时强制启用多页面(需要用到router) if (!ssr && pages && pages.length === 1) { features.pages = false; } if (!(tabBar && tabBar.list && tabBar.list.length)) { features.tabBar = false; features.tabBarMidButton = false; } if (features.tabBar && !tabBar.midButton) { features.tabBarMidButton = false; } if (topWindow && topWindow.path) { features.topWindow = true; } if (leftWindow && leftWindow.path) { features.leftWindow = true; } if (rightWindow && rightWindow.path) { features.rightWindow = true; } if (globalStyle.enablePullDownRefresh) { features.pullDownRefresh = true; } else { if (pages.find((page) => page.style && page.style.enablePullDownRefresh)) { features.pullDownRefresh = true; } } if (command === 'build') { if (!pages.find((page) => fs_1.default.existsSync(path_1.default.resolve(inputDir, page.path + '.nvue')))) { features.nvue = false; } let isNavigationCustom = false; if (globalStyle.navigationBar.style === 'custom') { isNavigationCustom = true; // 全局custom if (pages.find((page) => page.style.navigationBar.style === 'default')) { isNavigationCustom = false; } } else { // 所有页面均custom if (pages.every((page) => page.style.navigationBar.style === 'custom')) { isNavigationCustom = true; } } if (isNavigationCustom) { features.navigationBar = false; features.navigationBarButtons = false; features.navigationBarSearchInput = false; features.navigationBarTransparent = false; } else { if (!pages.find((page) => (0, shared_1.isArray)(page.style.navigationBar.buttons) && page.style.navigationBar.buttons.length)) { features.navigationBarButtons = false; } if (!globalStyle.navigationBar.searchInput && !pages.find((page) => page.style.navigationBar.searchInput)) { features.navigationBarSearchInput = false; } if (globalStyle.navigationBar.type !== 'transparent' && !pages.find((page) => page.style.navigationBar.type === 'transparent')) { features.navigationBarTransparent = false; } } } return features; } function initManifestFeature({ manifestJson, command, platform, }) { const features = { wx: false, wxs: true, rpx: true, promise: false, longpress: true, routerMode: '"hash"', vueOptionsApi: true, vueProdDevTools: false, }; if (command === 'build') { // TODO 需要预编译一遍? // features.wxs = false // features.longpress = false } if (manifestJson.h5 && manifestJson.h5.router && manifestJson.h5.router.mode === 'history') { features.routerMode = '"history"'; } // TODO other features return features; } function initFeatures(options) { const { wx, wxs, rpx, nvue, uniCloud, i18nEn, i18nEs, i18nFr, i18nZhHans, i18nZhHant, i18nLocale, vueOptionsApi, vueProdDevTools, pages, tabBar, tabBarMidButton, promise, longpress, routerMode, topWindow, leftWindow, rightWindow, navigationBar, pullDownRefresh, navigationBarButtons, navigationBarSearchInput, navigationBarTransparent, } = (0, shared_1.extend)(initManifestFeature(options), initPagesFeature(options), initProjectFeature(options)); const features = { // vue __VUE_OPTIONS_API__: vueOptionsApi, __VUE_PROD_DEVTOOLS__: vueProdDevTools, // uni __UNI_FEATURE_WX__: wx, __UNI_FEATURE_WXS__: wxs, __UNI_FEATURE_RPX__: rpx, __UNI_FEATURE_PROMISE__: promise, __UNI_FEATURE_LONGPRESS__: longpress, __UNI_FEATURE_I18N_EN__: i18nEn, __UNI_FEATURE_I18N_ES__: i18nEs, __UNI_FEATURE_I18N_FR__: i18nFr, __UNI_FEATURE_I18N_ZH_HANS__: i18nZhHans, __UNI_FEATURE_I18N_ZH_HANT__: i18nZhHant, // 以下特性,编译器已自动识别是否需要启用 __UNI_FEATURE_UNI_CLOUD__: uniCloud, __UNI_FEATURE_I18N_LOCALE__: i18nLocale, __UNI_FEATURE_NVUE__: nvue, __UNI_FEATURE_ROUTER_MODE__: routerMode, __UNI_FEATURE_PAGES__: pages, __UNI_FEATURE_TABBAR__: tabBar, __UNI_FEATURE_TABBAR_MIDBUTTON__: tabBarMidButton, __UNI_FEATURE_TOPWINDOW__: topWindow, __UNI_FEATURE_LEFTWINDOW__: leftWindow, __UNI_FEATURE_RIGHTWINDOW__: rightWindow, __UNI_FEATURE_RESPONSIVE__: topWindow || leftWindow || rightWindow, __UNI_FEATURE_NAVIGATIONBAR__: navigationBar, __UNI_FEATURE_PULL_DOWN_REFRESH__: pullDownRefresh, __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__: navigationBarButtons, __UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__: navigationBarSearchInput, __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__: navigationBarTransparent, // 是否启用透明标题栏 }; // ssr nodejs features if (options.ssr) { Object.keys(features).forEach((name) => { const value = features[name]; (0, shared_1.extend)(globalThis, { [name]: (0, shared_1.isString)(value) ? JSON.parse(value) : value, }); }); } return features; } exports.initFeatures = initFeatures; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156597, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UNI_EASYCOM_EXCLUDE = exports.genResolveEasycomCode = exports.addImportDeclaration = exports.matchEasycom = exports.initEasycomsOnce = exports.initEasycoms = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const debug_1 = __importDefault(require("debug")); const shared_1 = require("@vue/shared"); const pluginutils_1 = require("@rollup/pluginutils"); const uni_shared_1 = require("@dcloudio/uni-shared"); const utils_1 = require("./utils"); const pages_1 = require("./json/pages"); const messages_1 = require("./messages"); const uts_1 = require("./uts"); const debugEasycom = (0, debug_1.default)('uni:easycom'); const easycoms = []; const easycomsCache = new Map(); const easycomsInvalidCache = new Set(); let hasEasycom = false; function clearEasycom() { easycoms.length = 0; easycomsCache.clear(); easycomsInvalidCache.clear(); } function initEasycoms(inputDir, { dirs, platform }) { const componentsDir = path_1.default.resolve(inputDir, 'components'); const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules'); const initEasycomOptions = (pagesJson) => { // 初始化时,从once中读取缓存,refresh时,实时读取 const { easycom } = pagesJson || (0, pages_1.parsePagesJson)(inputDir, platform, false); const easycomOptions = { dirs: easycom && easycom.autoscan === false ? [...dirs] // 禁止自动扫描 : [ ...dirs, componentsDir, ...initUniModulesEasycomDirs(uniModulesDir), ], rootDir: inputDir, autoscan: !!(easycom && easycom.autoscan), custom: (easycom && easycom.custom) || {}, }; debugEasycom(easycomOptions); return easycomOptions; }; const options = initEasycomOptions((0, pages_1.parsePagesJsonOnce)(inputDir, platform)); const initUTSEasycom = () => { (0, uts_1.initUTSComponents)(inputDir, platform).forEach((item) => { const index = easycoms.findIndex((easycom) => item.name === easycom.name); if (index > -1) { easycoms.splice(index, 1, item); } else { easycoms.push(item); } }); }; initEasycom(options); initUTSEasycom(); const res = { options, filter: (0, pluginutils_1.createFilter)([ 'components/*/*.(vue|jsx|tsx)', 'uni_modules/*/components/*/*.(vue|jsx|tsx)', 'utssdk/*/**/*.vue', 'uni_modules/*/utssdk/*/*.vue', ], [], { resolve: inputDir, }), refresh() { res.options = initEasycomOptions(); initEasycom(res.options); initUTSEasycom(); }, easycoms, }; return res; } exports.initEasycoms = initEasycoms; exports.initEasycomsOnce = (0, uni_shared_1.once)(initEasycoms); function initUniModulesEasycomDirs(uniModulesDir) { if (!fs_1.default.existsSync(uniModulesDir)) { return []; } return fs_1.default .readdirSync(uniModulesDir) .map((uniModuleDir) => { const uniModuleComponentsDir = path_1.default.resolve(uniModulesDir, uniModuleDir, 'components'); if (fs_1.default.existsSync(uniModuleComponentsDir)) { return uniModuleComponentsDir; } }) .filter(Boolean); } function initEasycom({ dirs, rootDir, custom, extensions = ['.vue', '.jsx', '.tsx'], }) { clearEasycom(); const easycomsObj = Object.create(null); if (dirs && dirs.length && rootDir) { (0, shared_1.extend)(easycomsObj, initAutoScanEasycoms(dirs, rootDir, extensions)); } if (custom) { Object.keys(custom).forEach((name) => { const componentPath = custom[name]; easycomsObj[name] = componentPath.startsWith('@/') ? (0, utils_1.normalizePath)(path_1.default.join(rootDir, componentPath.slice(2))) : componentPath; }); } Object.keys(easycomsObj).forEach((name) => { easycoms.push({ name: name.startsWith('^') && name.endsWith('$') ? name.slice(1, -1) : name, pattern: new RegExp(name), replacement: easycomsObj[name], }); }); debugEasycom(easycoms); hasEasycom = !!easycoms.length; return easycoms; } function matchEasycom(tag) { if (!hasEasycom) { return; } let source = easycomsCache.get(tag); if (source) { return source; } if (easycomsInvalidCache.has(tag)) { return false; } const matcher = easycoms.find((matcher) => matcher.pattern.test(tag)); if (!matcher) { easycomsInvalidCache.add(tag); return false; } source = tag.replace(matcher.pattern, matcher.replacement); easycomsCache.set(tag, source); debugEasycom('matchEasycom', tag, source); return source; } exports.matchEasycom = matchEasycom; const isDir = (path) => fs_1.default.lstatSync(path).isDirectory(); function initAutoScanEasycom(dir, rootDir, extensions) { if (!path_1.default.isAbsolute(dir)) { dir = path_1.default.resolve(rootDir, dir); } const easycoms = Object.create(null); if (!fs_1.default.existsSync(dir)) { return easycoms; } fs_1.default.readdirSync(dir).forEach((name) => { const folder = path_1.default.resolve(dir, name); if (!isDir(folder)) { return; } const importDir = (0, utils_1.normalizePath)(folder); const files = fs_1.default.readdirSync(folder); // 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确) for (let i = 0; i < extensions.length; i++) { const ext = extensions[i]; if (files.includes(name + ext)) { easycoms[`^${name}$`] = `${importDir}/${name}${ext}`; break; } } }); return easycoms; } function initAutoScanEasycoms(dirs, rootDir, extensions) { const conflict = {}; const res = dirs.reduce((easycoms, dir) => { const curEasycoms = initAutoScanEasycom(dir, rootDir, extensions); Object.keys(curEasycoms).forEach((name) => { // Use the first component when name conflict const componentPath = easycoms[name]; if (!componentPath) { easycoms[name] = curEasycoms[name]; } else { ; (conflict[componentPath] || (conflict[componentPath] = [])).push(normalizeComponentPath(curEasycoms[name], rootDir)); } }); return easycoms; }, Object.create(null)); const conflictComponents = Object.keys(conflict); if (conflictComponents.length) { console.warn(messages_1.M['easycom.conflict']); conflictComponents.forEach((com) => { console.warn([normalizeComponentPath(com, rootDir), conflict[com]].join(',')); }); } return res; } function normalizeComponentPath(componentPath, rootDir) { return (0, utils_1.normalizePath)(path_1.default.relative(rootDir, componentPath)); } function addImportDeclaration(importDeclarations, local, source, imported) { importDeclarations.push(createImportDeclaration(local, source, imported)); return local; } exports.addImportDeclaration = addImportDeclaration; function createImportDeclaration(local, source, imported) { if (imported) { return `import { ${imported} as ${local} } from '${source}';`; } return `import ${local} from '${source}';`; } const RESOLVE_EASYCOM_IMPORT_CODE = `import { resolveDynamicComponent as __resolveDynamicComponent } from 'vue';import { resolveEasycom } from '@dcloudio/uni-app';`; function genResolveEasycomCode(importDeclarations, code, name) { if (!importDeclarations.includes(RESOLVE_EASYCOM_IMPORT_CODE)) { importDeclarations.push(RESOLVE_EASYCOM_IMPORT_CODE); } return `resolveEasycom(${code.replace('_resolveComponent', '__resolveDynamicComponent')}, ${name})`; } exports.genResolveEasycomCode = genResolveEasycomCode; exports.UNI_EASYCOM_EXCLUDE = [/App.vue$/, /@dcloudio\/uni-h5/]; }, function(modId) { var map = {"fs":1745998156463,"./messages":1745998156485,"./uts":1745998156575}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156600, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.initPostcssPlugin = exports.uniPostcssScopedPlugin = exports.uniPostcssPlugin = void 0; const stylePluginScoped_1 = __importDefault(require("./plugins/stylePluginScoped")); exports.uniPostcssScopedPlugin = stylePluginScoped_1.default; const uniapp_1 = __importDefault(require("./plugins/uniapp")); exports.uniPostcssPlugin = uniapp_1.default; function initPostcssPlugin({ uniApp, autoprefixer, } = {}) { const plugins = [(0, uniapp_1.default)(uniApp)]; // nvue 不需要 autoprefixer if (autoprefixer !== false) { plugins.push(require('autoprefixer')(autoprefixer)); } return plugins; } exports.initPostcssPlugin = initPostcssPlugin; }, function(modId) { var map = {"./plugins/stylePluginScoped":1745998156601}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156601, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const postcss_selector_parser_1 = __importDefault(require("postcss-selector-parser")); const scopedPlugin = () => { return { postcssPlugin: 'uni-sfc-scoped', prepare({ processor: { plugins } }) { const hasVueSfcScoped = !!plugins.find((plugin) => plugin.postcssPlugin === 'vue-sfc-scoped'); return { Rule(rule) { processRule(rule, hasVueSfcScoped); }, }; }, }; }; const processedRules = new WeakSet(); function processRule(rule, hasVueSfcScoped) { if (processedRules.has(rule) || (rule.parent && rule.parent.type === 'atrule' && /-?keyframes$/.test(rule.parent.name))) { return; } processedRules.add(rule); rule.selector = (0, postcss_selector_parser_1.default)((selectorRoot) => { selectorRoot.each((selector) => { hasVueSfcScoped ? rewriteDeprecatedSelector(selector) : rewriteSelector(selector, selectorRoot); }); }).processSync(rule.selector); } /** * @param selector * @returns */ function rewriteDeprecatedSelector(selector) { const nodes = []; let deepNode; selector.each((n) => { if (deepNode) { nodes.push(n); selector.removeChild(n); } else { const { type, value } = n; if (type === 'pseudo' && value === '::v-deep') { deepNode = n; } else if (type === 'combinator' && (value === '>>>' || value === '/deep/')) { deepNode = n; } } }); if (!deepNode) { return; } if (deepNode.type === 'combinator') { const index = selector.index(deepNode); if (index > 0) { selector.insertBefore(deepNode, postcss_selector_parser_1.default.combinator({ value: ' ' })); } } // remove first combinator // ::v-deep a{color:red;} => :deep(a){color:red;} const firstNode = nodes[0]; if (firstNode && firstNode.type === 'combinator' && firstNode.value === ' ') { nodes.shift(); } selector.insertBefore(deepNode, postcss_selector_parser_1.default.pseudo({ value: ':deep', nodes: [postcss_selector_parser_1.default.selector({ value: '', nodes })], })); selector.removeChild(deepNode); } function rewriteSelector(selector, selectorRoot) { let node = null; // find the last child node to insert attribute selector selector.each((n) => { // DEPRECATED ">>>" and "/deep/" combinator if (n.type === 'combinator' && (n.value === '>>>' || n.value === '/deep/')) { n.value = ' '; n.spaces.before = n.spaces.after = ''; // warn( // `the >>> and /deep/ combinators have been deprecated. ` + // `Use :deep() instead.` // ) return false; } if (n.type === 'pseudo') { const { value } = n; // deep: inject [id] attribute at the node before the ::v-deep // combinator. if (value === ':deep' || value === '::v-deep') { if (n.nodes.length) { // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar // replace the current node with ::v-deep's inner selector let last = n; n.nodes[0].each((ss) => { selector.insertAfter(last, ss); last = ss; }); // insert a space combinator before if it doesn't already have one const prev = selector.at(selector.index(n) - 1); if (!prev || !isSpaceCombinator(prev)) { selector.insertAfter(n, postcss_selector_parser_1.default.combinator({ value: ' ', })); } selector.removeChild(n); } else { // DEPRECATED usage // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar // warn( // `::v-deep usage as a combinator has ` + // `been deprecated. Use :deep() instead.` // ) const prev = selector.at(selector.index(n) - 1); if (prev && isSpaceCombinator(prev)) { selector.removeChild(prev); } selector.removeChild(n); } return false; } // slot: use selector inside `::v-slotted` and inject [id + '-s'] // instead. // ::v-slotted(.foo) -> .foo[xxxxxxx-s] if (value === ':slotted' || value === '::v-slotted') { rewriteSelector(n.nodes[0], selectorRoot); let last = n; n.nodes[0].each((ss) => { selector.insertAfter(last, ss); last = ss; }); // selector.insertAfter(n, n.nodes[0]) selector.removeChild(n); // since slotted attribute already scopes the selector there's no // need for the non-slot attribute. return false; } // global: replace with inner selector and do not inject [id]. // ::v-global(.foo) -> .foo if (value === ':global' || value === '::v-global') { selectorRoot.insertAfter(selector, n.nodes[0]); selectorRoot.removeChild(selector); return false; } } if (n.type !== 'pseudo' && n.type !== 'combinator') { node = n; } }); if (node) { ; node.spaces.after = ''; } else { // For deep selectors & standalone pseudo selectors, // the attribute selectors are prepended rather than appended. // So all leading spaces must be eliminated to avoid problems. selector.first.spaces.before = ''; } } function isSpaceCombinator(node) { return node.type === 'combinator' && /^\s+$/.test(node.value); } scopedPlugin.postcss = true; exports.default = scopedPlugin; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156603, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.parseFilterNames = exports.missingModuleName = exports.parseRenderjs = exports.isRenderjs = exports.isSjs = exports.isWxs = void 0; const url_1 = require("./vite/utils/url"); const WXS_RE = /vue&type=wxs/; function isWxs(id) { return WXS_RE.test(id); } exports.isWxs = isWxs; const SJS_RE = /vue&type=sjs/; function isSjs(id) { return SJS_RE.test(id); } exports.isSjs = isSjs; const RENDERJS_RE = /vue&type=renderjs/; function isRenderjs(id) { return RENDERJS_RE.test(id); } exports.isRenderjs = isRenderjs; function parseRenderjs(id) { if (isWxs(id) || isRenderjs(id) || isSjs(id)) { const { query, filename } = (0, url_1.parseVueRequest)(id); return { type: query.type, name: query.name, filename, }; } return { type: '', name: '', filename: '', }; } exports.parseRenderjs = parseRenderjs; function missingModuleName(type, code) { return ``; } exports.missingModuleName = missingModuleName; const moduleRE = /module=["'](.*?)["']/; function parseFilterNames(lang, code) { const names = []; const scriptTags = code.match(/]*>/gm); if (!scriptTags) { return names; } const langRE = new RegExp(`lang=["']${lang}["']`); scriptTags.forEach((scriptTag) => { if (langRE.test(scriptTag)) { const matches = scriptTag.match(moduleRE); if (matches) { names.push(matches[1]); } } }); return names; } exports.parseFilterNames = parseFilterNames; }, function(modId) { var map = {"./vite/utils/url":1745998156492}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156604, function(require, module, exports) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.esbuild = exports.transformWithEsbuild = void 0; const path_1 = __importDefault(require("path")); function transformWithEsbuild(code, filename, options) { options.stdin = { contents: code, resolveDir: path_1.default.dirname(filename), }; return Promise.resolve().then(() => __importStar(require('esbuild'))).then((esbuild) => { return esbuild.build(options); }); } exports.transformWithEsbuild = transformWithEsbuild; function esbuild(options) { return Promise.resolve().then(() => __importStar(require('esbuild'))).then((esbuild) => { return esbuild.build(options); }); } exports.esbuild = esbuild; }, function(modId) { var map = {"esbuild":1745998156604}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156606, function(require, module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isMiniProgramPlatform = exports.getPlatformDir = exports.getPlatforms = exports.registerPlatform = void 0; const BUILT_IN_PLATFORMS = [ 'app', 'app-plus', 'h5', 'mp-360', 'mp-alipay', 'mp-baidu', 'mp-jd', 'mp-kuaishou', 'mp-lark', 'mp-qq', 'mp-toutiao', 'mp-weixin', 'quickapp-webview', 'quickapp-webview-huawei', 'quickapp-webview-union', ]; const platforms = [...BUILT_IN_PLATFORMS]; function registerPlatform(platform) { if (!platforms.includes(platform)) { platforms.push(platform); } } exports.registerPlatform = registerPlatform; function getPlatforms() { return platforms; } exports.getPlatforms = getPlatforms; function getPlatformDir() { return process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM; } exports.getPlatformDir = getPlatformDir; function isMiniProgramPlatform() { return !['app', 'app-plus', 'h5', 'web'].includes(process.env.UNI_PLATFORM); } exports.isMiniProgramPlatform = isMiniProgramPlatform; }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156608, function(require, module, exports) { var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.chokidar = void 0; var chokidar_1 = require("chokidar"); Object.defineProperty(exports, "chokidar", { enumerable: true, get: function () { return __importDefault(chokidar_1).default; } }); }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) __DEFINE__(1745998156609, function(require, module, exports) { /* eslint-disable */ // @ts-ignore Object.defineProperty(exports, "__esModule", { value: true }); exports.checkUpdate = void 0; var __importDefault = this && this.__importDefault || function (mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.createPostData = exports.getMac = exports.md5 = exports.checkLocalCache = exports.checkUpdate1 = void 0; const fs_extra_1 = __importDefault(require("fs-extra")), os_1 = __importDefault(require("os")), path_1 = __importDefault(require("path")), debug_1 = __importDefault(require("debug")), crypto_1 = __importDefault(require("crypto")), https_1 = require("https"), compare_versions_1 = __importDefault(require("compare-versions")), shared_1 = require("@vue/shared"), json_1 = require("./json"), hbx_1 = require("./hbx"), debugCheckUpdate = (0, debug_1.default)("uni:check-update"), INTERVAL = 864e5; async function checkUpdate1(options) { if (process.env.CI) return void debugCheckUpdate("isInCI"); if ((0, hbx_1.isInHBuilderX)()) return void debugCheckUpdate("isInHBuilderX"); const { inputDir: inputDir, compilerVersion: compilerVersion } = options, updateCache = readCheckUpdateCache(inputDir); debugCheckUpdate("read.cache", updateCache); const res = checkLocalCache(updateCache, compilerVersion); res ? (0, shared_1.isString)(res) && (console.log(), console.log(res)) : await checkVersion(options, normalizeUpdateCache(updateCache, (0, json_1.parseManifestJsonOnce)(inputDir))), writeCheckUpdateCache(inputDir, statUpdateCache(normalizeUpdateCache(updateCache))); } function normalizeUpdateCache(updateCache, manifestJson) { const platform = process.env.UNI_PLATFORM; if (updateCache[platform] || (updateCache[platform] = { appid: "", dev: 0, build: 0 }), manifestJson) { const platformOptions = manifestJson["app" === platform ? "app-plus" : platform]; updateCache[platform].appid = platformOptions && (platformOptions.appid || platformOptions.package) || ""; } return updateCache; } function statUpdateCache(updateCache) { debugCheckUpdate("stat.before", updateCache); const platform = process.env.UNI_PLATFORM, type = "production" === process.env.NODE_ENV ? "build" : "dev", platformOptions = updateCache[platform]; return platformOptions[type] = (platformOptions[type] || 0) + 1, debugCheckUpdate("stat.after", updateCache), updateCache; } function getFilepath(inputDir, filename) { return path_1.default.resolve(os_1.default.tmpdir(), "uni-app-cli", md5(inputDir), filename); } function getCheckUpdateFilepath(inputDir) { return getFilepath(inputDir, "check-update.json"); } function generateVid() { let result = ""; for (let i = 0; i < 4; i++) result += (65536 * (1 + Math.random()) | 0).toString(16).substring(1); return "UNI_" + result.toUpperCase(); } function createCheckUpdateCache(vid = generateVid()) { return { vid: generateVid(), lastCheck: 0 }; } function readCheckUpdateCache(inputDir) { const updateFilepath = getCheckUpdateFilepath(inputDir); if (debugCheckUpdate("read:", updateFilepath), fs_extra_1.default.existsSync(updateFilepath)) try { return require(updateFilepath); } catch (e) { debugCheckUpdate("read.error", e); } return createCheckUpdateCache(); } function checkLocalCache(updateCache, compilerVersion, interval = INTERVAL) { return updateCache.lastCheck ? Date.now() - updateCache.lastCheck > interval ? (debugCheckUpdate("cache: lastCheck > interval"), !1) : !(updateCache.newVersion && (0, compare_versions_1.default)(updateCache.newVersion, compilerVersion) > 0) || (debugCheckUpdate("cache: find new version"), updateCache.note) : (debugCheckUpdate("cache: lastCheck not found"), !1); } function writeCheckUpdateCache(inputDir, updateCache) { const filepath = getCheckUpdateFilepath(inputDir); debugCheckUpdate("write:", filepath, updateCache); try { fs_extra_1.default.outputFileSync(filepath, JSON.stringify(updateCache)); } catch (e) { debugCheckUpdate("write.error", e); } } function md5(str) { return crypto_1.default.createHash("md5").update(str).digest("hex"); } function getMac() { let mac = ""; const network = os_1.default.networkInterfaces(); for (const key in network) { const array = network[key]; for (let i = 0; i < array.length; i++) { const item = array[i]; if (item.family && (!item.mac || "00:00:00:00:00:00" !== item.mac)) { if ((0, shared_1.isString)(item.family) && ("IPv4" === item.family || "IPv6" === item.family)) { mac = item.mac; break; } if ("number" == typeof item.family && (4 === item.family || 6 === item.family)) { mac = item.mac; break; } } } } return mac; } function createPostData({ versionType: versionType, compilerVersion: compilerVersion }, manifestJson, updateCache) { const data = { vv: 3, device: md5(getMac()), vtype: versionType, vcode: compilerVersion }; return manifestJson.appid ? data.appid = manifestJson.appid : data.vid = updateCache.vid, Object.keys(updateCache).forEach((name => { const value = updateCache[name]; (0, shared_1.isPlainObject)(value) && ((0, shared_1.hasOwn)(value, "dev") || (0, shared_1.hasOwn)(value, "build")) && (data[name] = value); })), JSON.stringify(data); } function handleCheckVersion({ code: code, isUpdate: isUpdate, newVersion: newVersion, note: note }, updateCache) { 0 === code && (Object.keys(updateCache).forEach((key => { "vid" !== key && delete updateCache[key]; })), updateCache.lastCheck = Date.now(), isUpdate ? (updateCache.note = note, updateCache.newVersion = newVersion) : (delete updateCache.note, delete updateCache.newVersion)); } exports.checkUpdate1 = checkUpdate1, exports.checkLocalCache = checkLocalCache, exports.md5 = md5, exports.getMac = getMac, exports.createPostData = createPostData; const HOSTNAME = "uniapp.dcloud.net.cn", PATH = "/update/cli"; function checkVersion(options, updateCache) { return new Promise((resolve => { const postData = JSON.stringify({ id: createPostData(options, (0, json_1.parseManifestJsonOnce)(options.inputDir), updateCache) }); let responseData = ""; const req = (0, https_1.request)({ hostname: HOSTNAME, path: PATH, port: 443, method: "POST", headers: { "Content-Type": "application/json", "Content-Length": postData.length } }, (res => { res.setEncoding("utf8"), res.on("data", (chunk => { responseData += chunk; })), res.on("end", (() => { debugCheckUpdate("response: ", responseData); try { handleCheckVersion(JSON.parse(responseData), updateCache); } catch (e) { } resolve(!0); })), res.on("error", (e => { debugCheckUpdate("response.error:", e), resolve(!1); })); })).on("error", (e => { debugCheckUpdate("request.error:", e), resolve(!1); })); debugCheckUpdate("request: ", postData), req.write(postData), req.end(); })); } exports.checkUpdate = checkUpdate1; }, function(modId) { var map = {"./json":1745998156506,"./hbx":1745998156551}; return __REQUIRE__(map[modId], modId); }) return __REQUIRE__(1745998156462); })() //miniprogram-npm-outsideDeps=["./utils","./scripts","./uni_modules","path","@babel/parser","../utils","@babel/types","estree-walker","fs","../json/app/manifest/nvue","@dcloudio/uni-shared","./format","../json/manifest","jsonc-parser","../../lib/preprocess","@vue/shared","magic-string","../json/mp/jsonFile","os-locale-s-fix","@vue/compiler-dom","../plugins/vitejs/plugins/asset","../plugins/vitejs/plugins/css","base64url","module","debug","./pages","./manifest","./jsonFile","../pages","../../utils","../manifest","merge","./uniConfig","../../../utils","../../pages","./plus","./nvue","./arguments","./safearea","./splashscreen","./confusion","./launchwebview","./tabBar","./env","@dcloudio/uni-i18n","fast-glob","./log","@rollup/pluginutils","module-alias","resolve","@vue/compiler-core","url","./vitejs/plugins/asset","./vitejs/plugins/css","./vitejs/utils","fs-extra","chokidar","./json/pages","./plugins/uniapp","autoprefixer","postcss-selector-parser","os","crypto","https","compare-versions"] //# sourceMappingURL=index.js.map