提交 01623b2e 编写于 作者: Q qiang

Merge branch 'dev' into alpha

...@@ -33,8 +33,8 @@ i18n.configure({ ...@@ -33,8 +33,8 @@ i18n.configure({
}, },
fallbacks: { fallbacks: {
'en_*': 'en', 'en_*': 'en',
'zh': 'zh_CN', zh: 'zh_CN',
'zh_*': 'zh_CN', 'zh_*': 'zh_CN'
} }
}) })
......
function format (lang) { function format (lang) {
const array = lang.split(/[\.,]/)[0].split(/[_-]/) const array = lang.split(/[.,]/)[0].split(/[_-]/)
array[0] = array[0].toLowerCase() array[0] = array[0].toLowerCase()
if (array[0] === 'zh') { if (array[0] === 'zh') {
array[1] = (array[1] || 'CN').toUpperCase() array[1] = (array[1] || 'CN').toUpperCase()
...@@ -10,4 +10,4 @@ function format (lang) { ...@@ -10,4 +10,4 @@ function format (lang) {
module.exports = { module.exports = {
format format
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ const { format } = require('./lang') ...@@ -2,7 +2,7 @@ const { format } = require('./lang')
const { osLocale } = require('os-locale-s-fix/cjs') const { osLocale } = require('os-locale-s-fix/cjs')
function getLocale () { function getLocale () {
return format(process.env.UNI_HBUILDERX_LANGID || osLocale.sync({ spawn: true, cache: false }) || defaultLocale) return format(process.env.UNI_HBUILDERX_LANGID || osLocale.sync({ spawn: true, cache: false }) || 'en')
} }
module.exports = { module.exports = {
......
...@@ -27,12 +27,12 @@ module.exports = { ...@@ -27,12 +27,12 @@ module.exports = {
} }
if (!scriptOptions.env || !scriptOptions.env.UNI_PLATFORM) { if (!scriptOptions.env || !scriptOptions.env.UNI_PLATFORM) {
console.error(uniI18n.__('cliShared.requireConfigUniPlatform', { "0": `package.json->uni-app->scripts->${name}->env ` })) console.error(uniI18n.__('cliShared.requireConfigUniPlatform', { 0: `package.json->uni-app->scripts->${name}->env ` }))
process.exit(0) process.exit(0)
} }
if (PLATFORMS.indexOf(scriptOptions.env.UNI_PLATFORM) === -1) { if (PLATFORMS.indexOf(scriptOptions.env.UNI_PLATFORM) === -1) {
console.error(uniI18n.__('cliShared.supportPlatform', { "0": 'UNI_PLATFORM', "1": JSON.stringify(PLATFORMS)})) console.error(uniI18n.__('cliShared.supportPlatform', { 0: 'UNI_PLATFORM', 1: JSON.stringify(PLATFORMS) }))
process.exit(0) process.exit(0)
} }
......
...@@ -113,7 +113,7 @@ function isNVuePage (page, root = '') { ...@@ -113,7 +113,7 @@ function isNVuePage (page, root = '') {
function isValidPage (page, root = '') { function isValidPage (page, root = '') {
if (typeof page === 'string' || !page.path) { // 不合法的配置 if (typeof page === 'string' || !page.path) { // 不合法的配置
console.warn(uniI18n.__('cliShared.pagesJsonError', { "0": 'https://uniapp.dcloud.io/collocation/pages?id=pages' })) console.warn(uniI18n.__('cliShared.pagesJsonError', { 0: 'https://uniapp.dcloud.io/collocation/pages?id=pages' }))
return false return false
} }
let pagePath = page.path let pagePath = page.path
...@@ -391,7 +391,7 @@ function initAutoComponents () { ...@@ -391,7 +391,7 @@ function initAutoComponents () {
}) })
if (conflictFiles.length > 0) { if (conflictFiles.length > 0) {
conflictFiles.forEach(files => { conflictFiles.forEach(files => {
console.warn(uniI18n.__('cliShared.easycomConflict', { "0": '[' + files.map((file, index) => { return file }).join(',') + ']' })) console.warn(uniI18n.__('cliShared.easycomConflict', { 0: '[' + files.map((file, index) => { return file }).join(',') + ']' }))
console.log('\n') console.log('\n')
}) })
} }
......
...@@ -25,7 +25,7 @@ function initPlugin (plugin) { ...@@ -25,7 +25,7 @@ function initPlugin (plugin) {
try { try {
pluginApi = require(path.join(plugin.id, (plugin.config.main || '/lib/uni.config.js'))) pluginApi = require(path.join(plugin.id, (plugin.config.main || '/lib/uni.config.js')))
} catch (e) { } catch (e) {
console.warn(uniI18n.__('cliShared.missingUniConfig', { "0": plugin.id })) console.warn(uniI18n.__('cliShared.missingUniConfig', { 0: plugin.id }))
} }
pluginApi && PLUGIN_KEYS.forEach(name => { pluginApi && PLUGIN_KEYS.forEach(name => {
...@@ -56,7 +56,7 @@ function resolvePlugins () { ...@@ -56,7 +56,7 @@ function resolvePlugins () {
return return
} }
if (!config.name) { if (!config.name) {
return console.warn(uniI18n.__('cliShared.missingNameAttribute', { "0": `${id}/package.json->uni-app` })) return console.warn(uniI18n.__('cliShared.missingNameAttribute', { 0: `${id}/package.json->uni-app` }))
} }
return { return {
id, id,
...@@ -75,7 +75,7 @@ function initExtends (name, plugin, plugins) { ...@@ -75,7 +75,7 @@ function initExtends (name, plugin, plugins) {
process.exit(0) process.exit(0)
} }
if (!plugin) { if (!plugin) {
console.error(uniI18n.__('cliShared.noFoundPlatformPlugin', { "0": extendsPlatform })) console.error(uniI18n.__('cliShared.noFoundPlatformPlugin', { 0: extendsPlatform }))
process.exit(0) process.exit(0)
} }
const extendsPlugin = plugins.find(plugin => plugin.name === extendsPlatform) const extendsPlugin = plugins.find(plugin => plugin.name === extendsPlatform)
...@@ -102,7 +102,7 @@ module.exports = { ...@@ -102,7 +102,7 @@ module.exports = {
const plugins = resolvePlugins() const plugins = resolvePlugins()
const plugin = plugins.find(plugin => plugin.name === process.env.UNI_PLATFORM) const plugin = plugins.find(plugin => plugin.name === process.env.UNI_PLATFORM)
if (!plugin) { if (!plugin) {
console.error(uniI18n.__('cliShared.noFoundPlatformPlugin', { "0": process.env.UNI_PLATFORM })) console.error(uniI18n.__('cliShared.noFoundPlatformPlugin', { 0: process.env.UNI_PLATFORM }))
process.exit(0) process.exit(0)
} }
const name = plugin.name const name = plugin.name
......
...@@ -13,7 +13,7 @@ module.exports = function migrate (input, out, options = {}) { ...@@ -13,7 +13,7 @@ module.exports = function migrate (input, out, options = {}) {
options.platform = options.platform || 'mp-weixin' options.platform = options.platform || 'mp-weixin'
const migrater = migraters[options.platform] const migrater = migraters[options.platform]
if (!migrater) { if (!migrater) {
return console.error(uniI18n.__('migration.errorOnlySupportConvert', { "0": Object.keys(migraters).join(',') })) return console.error(uniI18n.__('migration.errorOnlySupportConvert', { 0: Object.keys(migraters).join(',') }))
} }
input = path.resolve(input) input = path.resolve(input)
out = path.resolve(out || input) out = path.resolve(out || input)
......
...@@ -7,7 +7,7 @@ const migraters = { ...@@ -7,7 +7,7 @@ const migraters = {
module.exports = function validate (input, out, options) { module.exports = function validate (input, out, options) {
if (!fs.existsSync(input)) { if (!fs.existsSync(input)) {
return console.error(uniI18n.__('migration.errorInputNotExists', { "0": input })) return console.error(uniI18n.__('migration.errorInputNotExists', { 0: input }))
} }
Object.assign(options, migraters[options.platform].options) Object.assign(options, migraters[options.platform].options)
const templateExtname = options.extname.template const templateExtname = options.extname.template
...@@ -15,7 +15,7 @@ module.exports = function validate (input, out, options) { ...@@ -15,7 +15,7 @@ module.exports = function validate (input, out, options) {
const stat = fs.lstatSync(input) const stat = fs.lstatSync(input)
if (stat.isFile()) { if (stat.isFile()) {
if (path.extname(input) !== templateExtname) { if (path.extname(input) !== templateExtname) {
return console.error(uniI18n.__('migration.errorConvertRequireFileUrl', { "0": templateExtname.substr(1) })) return console.error(uniI18n.__('migration.errorConvertRequireFileUrl', { 0: templateExtname.substr(1) }))
} }
options.target = 'file' options.target = 'file'
} else if (stat.isDirectory()) { } else if (stat.isDirectory()) {
...@@ -26,7 +26,7 @@ module.exports = function validate (input, out, options) { ...@@ -26,7 +26,7 @@ module.exports = function validate (input, out, options) {
options.target = 'folder' options.target = 'folder'
} }
} else { } else {
return console.error(uniI18n.__('migration.errorCannotConvert', { "0": input })) return console.error(uniI18n.__('migration.errorCannotConvert', { 0: input }))
} }
return true return true
} }
...@@ -107,7 +107,7 @@ module.exports = { ...@@ -107,7 +107,7 @@ module.exports = {
] ]
if (t.isIdentifier(value)) { if (t.isIdentifier(value)) {
if (value.name !== key.name) { if (value.name !== key.name) {
state.errors.add(uniI18n.__('mpWeChat.slotPropNoSupportReanme', { "0": key.name, "1": value.name })) state.errors.add(uniI18n.__('mpWeChat.slotPropNoSupportReanme', { 0: key.name, 1: value.name }))
} }
} else if (t.isAssignmentPattern(value)) { } else if (t.isAssignmentPattern(value)) {
valueObjectProperties.push(t.objectProperty(t.identifier('default'), value.right)) valueObjectProperties.push(t.objectProperty(t.identifier('default'), value.right))
...@@ -115,7 +115,7 @@ module.exports = { ...@@ -115,7 +115,7 @@ module.exports = {
objectProperties.push(t.objectProperty(key, t.objectExpression(valueObjectProperties))) objectProperties.push(t.objectProperty(key, t.objectExpression(valueObjectProperties)))
}) })
} else { } else {
state.errors.add(uniI18n.__('mpWeChat.onlySupportDestructuringSlot', { "0": paramExprNode.name, "1": 'v-slot="{ user }"'})) state.errors.add(uniI18n.__('mpWeChat.onlySupportDestructuringSlot', { 0: paramExprNode.name, 1: 'v-slot="{ user }"' }))
} }
const jsContent = generateJsCode(genCode(t.objectExpression(objectProperties), true)) const jsContent = generateJsCode(genCode(t.objectExpression(objectProperties), true))
state.files[jsFile] = jsContent state.files[jsFile] = jsContent
......
...@@ -111,7 +111,7 @@ ${content} ...@@ -111,7 +111,7 @@ ${content}
return `${eventType}${eventName}` // 原生组件不支持 bind:input 等写法,统一使用 bindinput return `${eventType}${eventName}` // 原生组件不支持 bind:input 等写法,统一使用 bindinput
}, },
createScopedSlots (slotName, props, state) { createScopedSlots (slotName, props, state) {
state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', { "0": `[${slotName}]` })) state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', { 0: `[${slotName}]` }))
return { return {
type: 'slot', type: 'slot',
attr: { attr: {
...@@ -124,7 +124,7 @@ ${content} ...@@ -124,7 +124,7 @@ ${content}
traverseExpr, traverseExpr,
normalizeChildren normalizeChildren
}, state) { }, state) {
state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', { "0": `[${slotName}]` })) state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', { 0: `[${slotName}]` }))
return { return {
type: 'view', type: 'view',
attr: { attr: {
......
...@@ -133,7 +133,7 @@ module.exports = function processClass (paths, path, state) { ...@@ -133,7 +133,7 @@ module.exports = function processClass (paths, path, state) {
// ) // )
// ) // )
} else { } else {
state.errors.add(':class' + uniI18n.__('templateCompiler.noSupportSyntax', { "0": getCode(classValuePath.node) })) state.errors.add(':class' + uniI18n.__('templateCompiler.noSupportSyntax', { 0: getCode(classValuePath.node) }))
} }
} }
return [] return []
......
...@@ -78,7 +78,7 @@ function addVueId (path, state) { ...@@ -78,7 +78,7 @@ function addVueId (path, state) {
const scoped = scopeds[i] const scoped = scopeds[i]
forIndexSet.add(scoped.forIndex) forIndexSet.add(scoped.forIndex)
if (forIndexSet.size !== i + 1) { if (forIndexSet.size !== i + 1) {
state.errors.add(uniI18n.__('templateCompiler.forNestedIndexNameNoArrowRepeat', { "0": 'v-for', "1": scoped.forIndex })) state.errors.add(uniI18n.__('templateCompiler.forNestedIndexNameNoArrowRepeat', { 0: 'v-for', 1: scoped.forIndex }))
break break
} }
} }
......
...@@ -82,7 +82,7 @@ function processElement (ast, state, isRoot) { ...@@ -82,7 +82,7 @@ function processElement (ast, state, isRoot) {
ast.attr['vue-slots'] = '{{[' + slots.reverse().map(slotName => `'${slotName}'`).join(',') + ']}}' ast.attr['vue-slots'] = '{{[' + slots.reverse().map(slotName => `'${slotName}'`).join(',') + ']}}'
} }
if (ast.attr.id && ast.attr.id.indexOf('{{') === 0) { if (ast.attr.id && ast.attr.id.indexOf('{{') === 0) {
state.tips.add(uniI18n.__('templateCompiler.idAttribNotAllowInCustomComponentProps', { "0": ast.type })) state.tips.add(uniI18n.__('templateCompiler.idAttribNotAllowInCustomComponentProps', { 0: ast.type }))
} }
if (hasOwn(ast.attr, 'data') && platformName !== 'mp-toutiao') { // 百度中会出现异常情况 if (hasOwn(ast.attr, 'data') && platformName !== 'mp-toutiao') { // 百度中会出现异常情况
// TODO 暂不输出 // TODO 暂不输出
......
...@@ -298,7 +298,7 @@ function genSlotNode (slotName, slotNode, fallbackNodes, state) { ...@@ -298,7 +298,7 @@ function genSlotNode (slotName, slotNode, fallbackNodes, state) {
function traverseRenderSlot (callExprNode, state) { function traverseRenderSlot (callExprNode, state) {
if (!t.isStringLiteral(callExprNode.arguments[0])) { if (!t.isStringLiteral(callExprNode.arguments[0])) {
state.errors.add(uniI18n.__('templateCompiler.notSupportDynamicSlotName', { "0": 'v-slot' })) state.errors.add(uniI18n.__('templateCompiler.notSupportDynamicSlotName', { 0: 'v-slot' }))
return return
} }
......
...@@ -116,7 +116,7 @@ function getForKey (forKey, forIndex, state) { ...@@ -116,7 +116,7 @@ function getForKey (forKey, forIndex, state) {
} else if (t.isMemberExpression(forKey)) { } else if (t.isMemberExpression(forKey)) {
return forKey.property.name || forKey.property.value return forKey.property.name || forKey.property.value
} else { } else {
state.tips.add(uniI18n.__('templateCompiler.noH5KeyNoSupportExpression', { "0": getCode(forKey), "1": 'https://uniapp.dcloud.io/use?id=key' })) state.tips.add(uniI18n.__('templateCompiler.noH5KeyNoSupportExpression', { 0: getCode(forKey), 1: 'https://uniapp.dcloud.io/use?id=key' }))
} }
} }
return '' return ''
......
...@@ -133,7 +133,7 @@ async function build (args, api, options) { ...@@ -133,7 +133,7 @@ async function build (args, api, options) {
log() log()
if (!runByHBuilderX && !runByAliIde) { if (!runByHBuilderX && !runByAliIde) {
logWithSpinner(uniI18n.__('pluginUni.startCompileProjectToPlatform', { "0": process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM, "1": process.env.UNI_MP_PLUGIN ? uniI18n.__('platform') : uniI18n.__('plugin') })) logWithSpinner(uniI18n.__('pluginUni.startCompileProjectToPlatform', { 0: process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM, 1: process.env.UNI_MP_PLUGIN ? uniI18n.__('platform') : uniI18n.__('plugin') }))
} }
const targetDir = api.resolve(options.outputDir) const targetDir = api.resolve(options.outputDir)
...@@ -219,7 +219,7 @@ function analysisPluginDir () { ...@@ -219,7 +219,7 @@ function analysisPluginDir () {
if (!fs.pathExistsSync(pluginJsonPath)) { if (!fs.pathExistsSync(pluginJsonPath)) {
console.log() console.log()
console.error(uniI18n.__('pluginUni.fileNoExistsCheckAfterRetry', { "0": pluginJsonName })) console.error(uniI18n.__('pluginUni.fileNoExistsCheckAfterRetry', { 0: pluginJsonName }))
console.log() console.log()
process.exit(0) process.exit(0)
} }
...@@ -233,7 +233,7 @@ function analysisPluginDir () { ...@@ -233,7 +233,7 @@ function analysisPluginDir () {
if (UNI_MP_PLUGIN_MAIN && !fs.pathExistsSync(mainFilePath)) { if (UNI_MP_PLUGIN_MAIN && !fs.pathExistsSync(mainFilePath)) {
console.log() console.log()
console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', { "0": UNI_MP_PLUGIN_MAIN })) console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', { 0: UNI_MP_PLUGIN_MAIN }))
console.log() console.log()
process.exit(0) process.exit(0)
} }
......
...@@ -58,7 +58,7 @@ if (process.env.UNI_CLOUD_SPACES) { ...@@ -58,7 +58,7 @@ if (process.env.UNI_CLOUD_SPACES) {
const hasUniCloudSpace = spaces.length > 0 const hasUniCloudSpace = spaces.length > 0
if (spaces.length === 1) { if (spaces.length === 1) {
const space = spaces[0] const space = spaces[0]
console.log(uniI18n.__('pluginUni.currentProjectDefaultSpaceId', { "0": space.id })) console.log(uniI18n.__('pluginUni.currentProjectDefaultSpaceId', { 0: space.id }))
} }
if ( if (
...@@ -66,13 +66,13 @@ if (process.env.UNI_CLOUD_SPACES) { ...@@ -66,13 +66,13 @@ if (process.env.UNI_CLOUD_SPACES) {
isH5 && isH5 &&
isProduction isProduction
) { ) {
console.warn(uniI18n.__('pluginUni.unicloudReleaseH5', { "0": 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5' })) console.warn(uniI18n.__('pluginUni.unicloudReleaseH5', { 0: 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5' }))
} else if ( } else if (
hasUniCloudSpace && hasUniCloudSpace &&
isH5 && isH5 &&
!isProduction !isProduction
) { ) {
console.warn(uniI18n.__('pluginUni.unicloudShowedRunByHBuilderX', { "0": 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5' })) console.warn(uniI18n.__('pluginUni.unicloudShowedRunByHBuilderX', { 0: 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5' }))
} }
process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => { process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => {
...@@ -295,7 +295,7 @@ if ( ...@@ -295,7 +295,7 @@ if (
process.env.UNI_USING_STAT = true process.env.UNI_USING_STAT = true
if (!process.UNI_STAT_CONFIG.appid && process.env.NODE_ENV === 'production') { if (!process.UNI_STAT_CONFIG.appid && process.env.NODE_ENV === 'production') {
console.log() console.log()
console.warn(uniI18n.__('pluginUni.uniStatisticsNoAppid', { "0": 'https://ask.dcloud.net.cn/article/36303' })) console.warn(uniI18n.__('pluginUni.uniStatisticsNoAppid', { 0: 'https://ask.dcloud.net.cn/article/36303' }))
console.log() console.log()
} }
} }
...@@ -321,10 +321,10 @@ const warningMsg = ...@@ -321,10 +321,10 @@ const warningMsg =
const needWarning = !platformOptions.usingComponents || usingComponentsAbsent const needWarning = !platformOptions.usingComponents || usingComponentsAbsent
let hasNVue = false let hasNVue = false
// 输出编译器版本等信息 // 输出编译器版本等信息
const compile_mode_url = 'https://ask.dcloud.net.cn/article/36074' const compileModeUrl = 'https://ask.dcloud.net.cn/article/36074'
if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
let compile_mode = (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + '' + (isNVueCompiler ? 'uni-app' : 'weex') const compileMode = (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + '' + (isNVueCompiler ? 'uni-app' : 'weex')
console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', { "0": compile_mode, "1": compile_mode_url })) console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', { 0: compileMode, 1: compileModeUrl }))
} else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-native') { } else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-native') {
try { try {
let info = '' let info = ''
...@@ -346,7 +346,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { ...@@ -346,7 +346,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
if (needWarning) { if (needWarning) {
console.log(warningMsg) console.log(warningMsg)
} }
console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', { "0": (isNVueCompiler ? 'uni-app' : 'weex'), "1": compile_mode_url })) console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', { 0: (isNVueCompiler ? 'uni-app' : 'weex'), 1: compileModeUrl }))
} else { } else {
console.log(info) console.log(info)
if (needWarning) { if (needWarning) {
...@@ -467,7 +467,7 @@ if ( ...@@ -467,7 +467,7 @@ if (
} }
if (process.env.UNI_PLATFORM.startsWith('mp-')) { if (process.env.UNI_PLATFORM.startsWith('mp-')) {
console.log(uniI18n.__('pluginUni.mpBrowserKernelDifference', { "0": "https://uniapp.dcloud.io/matter?id=mp" })) console.log(uniI18n.__('pluginUni.mpBrowserKernelDifference', { 0: 'https://uniapp.dcloud.io/matter?id=mp' }))
} }
runByHBuilderX && console.log(uniI18n.__('compiling')) runByHBuilderX && console.log(uniI18n.__('compiling'))
......
...@@ -31,10 +31,10 @@ module.exports = function babelPluginGlobalComponent ({ ...@@ -31,10 +31,10 @@ module.exports = function babelPluginGlobalComponent ({
} }
if (callee.object.name === 'Vue' && callee.property.name === 'component') { if (callee.object.name === 'Vue' && callee.property.name === 'component') {
if (!args[0] || args[0].type !== 'StringLiteral') { if (!args[0] || args[0].type !== 'StringLiteral') {
throw new Error(uniI18n.__('mpLoader.firstParameterNeedStaticString', { "0": "Vue.component()" })) throw new Error(uniI18n.__('mpLoader.firstParameterNeedStaticString', { 0: 'Vue.component()' }))
} }
if (!args[1]) { if (!args[1]) {
throw new Error(uniI18n.__('mpLoader.requireTwoParameter', { "0": "Vue.component()" })) throw new Error(uniI18n.__('mpLoader.requireTwoParameter', { 0: 'Vue.component()' }))
} }
if (!metadata.globalComponents) { if (!metadata.globalComponents) {
metadata.globalComponents = {} metadata.globalComponents = {}
......
...@@ -65,7 +65,7 @@ module.exports = function ({ ...@@ -65,7 +65,7 @@ module.exports = function ({
const value = prop.value.name const value = prop.value.name
const source = findSource(value, path.scope.bindings) const source = findSource(value, path.scope.bindings)
if (!source) { if (!source) {
throw new Error(uniI18n.__('mpLoader.componentReferenceError', { "0": key })) throw new Error(uniI18n.__('mpLoader.componentReferenceError', { 0: key }))
} }
if (process.UNI_LIBRARIES.includes(source)) { if (process.UNI_LIBRARIES.includes(source)) {
const componentName = hyphenate(key) const componentName = hyphenate(key)
......
...@@ -24,10 +24,10 @@ module.exports = function (ast, state = {}) { ...@@ -24,10 +24,10 @@ module.exports = function (ast, state = {}) {
const nameNode = args[0] const nameNode = args[0]
const valueNode = args[1] const valueNode = args[1]
if (!t.isStringLiteral(nameNode)) { if (!t.isStringLiteral(nameNode)) {
throw new Error(uniI18n.__('mpLoader.firstParameterNeedStaticString', { "0": "Vue.component()" })) throw new Error(uniI18n.__('mpLoader.firstParameterNeedStaticString', { 0: 'Vue.component()' }))
} }
if (!t.isIdentifier(valueNode)) { if (!t.isIdentifier(valueNode)) {
throw new Error(uniI18n.__('mpLoader.requireTwoParameter', { "0": "Vue.component()" })) throw new Error(uniI18n.__('mpLoader.requireTwoParameter', { 0: 'Vue.component()' }))
} }
imports.push({ imports.push({
name: nameNode.value, name: nameNode.value,
......
...@@ -35,7 +35,7 @@ function parseComponents (names, bindings, path) { ...@@ -35,7 +35,7 @@ function parseComponents (names, bindings, path) {
}) => { }) => {
const importDeclaration = findImportDeclaration(value, bindings) const importDeclaration = findImportDeclaration(value, bindings)
if (!importDeclaration) { if (!importDeclaration) {
throw new Error(uniI18n.__('mpLoader.componentReferenceErrorOnlySupportImport', { "0": name })) throw new Error(uniI18n.__('mpLoader.componentReferenceErrorOnlySupportImport', { 0: name }))
} }
let source = importDeclaration.node.source.value let source = importDeclaration.node.source.value
if (process.UNI_LIBRARIES && process.UNI_LIBRARIES.includes(source)) { if (process.UNI_LIBRARIES && process.UNI_LIBRARIES.includes(source)) {
......
...@@ -97,7 +97,7 @@ createPage(Page) ...@@ -97,7 +97,7 @@ createPage(Page)
const babelLoader = findBabelLoader(this.loaders) const babelLoader = findBabelLoader(this.loaders)
if (!babelLoader) { if (!babelLoader) {
throw new Error(uniI18n.__('mpLoader.findFail', { "0": "babel-loader" })) throw new Error(uniI18n.__('mpLoader.findFail', { 0: 'babel-loader' }))
} else { } else {
addCreateApp(babelLoader) addCreateApp(babelLoader)
} }
......
...@@ -126,7 +126,7 @@ module.exports = function (content, map) { ...@@ -126,7 +126,7 @@ module.exports = function (content, map) {
const babelLoader = findBabelLoader(this.loaders) const babelLoader = findBabelLoader(this.loaders)
if (!babelLoader) { if (!babelLoader) {
callback(new Error(uniI18n.__('mpLoader.findFail', { "0": "babel-loader" })), content) callback(new Error(uniI18n.__('mpLoader.findFail', { 0: 'babel-loader' })), content)
} else { } else {
addDynamicImport(babelLoader, resourcePath, dynamicImports) addDynamicImport(babelLoader, resourcePath, dynamicImports)
......
...@@ -112,7 +112,7 @@ module.exports = function (content, map) { ...@@ -112,7 +112,7 @@ module.exports = function (content, map) {
if (!isAppView && jsonFile.name === 'manifest.json') { if (!isAppView && jsonFile.name === 'manifest.json') {
const content = JSON.parse(jsonFile.content) const content = JSON.parse(jsonFile.content)
if (!content.launch_path && content.plus['uni-app'].nvueLaunchMode === 'fast') { if (!content.launch_path && content.plus['uni-app'].nvueLaunchMode === 'fast') {
console.log(uniI18n.__('pagesLoader.nvueFirstPageStartModeIsFast', { "0": "https://ask.dcloud.net.cn/article/36749" })) console.log(uniI18n.__('pagesLoader.nvueFirstPageStartModeIsFast', { 0: 'https://ask.dcloud.net.cn/article/36749' }))
} }
} }
if (jsonFile.name === 'define-pages.js') { if (jsonFile.name === 'define-pages.js') {
......
...@@ -42,7 +42,7 @@ const pagesJson2AppJson = { ...@@ -42,7 +42,7 @@ const pagesJson2AppJson = {
tabBar: function (name, value, json, fromJson) { tabBar: function (name, value, json, fromJson) {
if (value && value.list && value.list.length) { if (value && value.list && value.list.length) {
if (value.list.length < 2) { if (value.list.length < 2) {
console.error(uniI18n.__('pagesLoader.pagesTabbarMinItem2', { "0": "tabBar.list" })) console.error(uniI18n.__('pagesLoader.pagesTabbarMinItem2', { 0: 'tabBar.list' }))
} }
const pages = json.pages const pages = json.pages
value.list.forEach((page, index) => { value.list.forEach((page, index) => {
...@@ -57,7 +57,7 @@ const pagesJson2AppJson = { ...@@ -57,7 +57,7 @@ const pagesJson2AppJson = {
}) => path === (page.pagePath + '.html')) }) => path === (page.pagePath + '.html'))
) )
) { ) {
console.error(uniI18n.__('pagesLoader.needInPagesNode', { "0": `pages.json tabBar['list'][${index}]['pagePath'] "${page.pagePath}"` })) console.error(uniI18n.__('pagesLoader.needInPagesNode', { 0: `pages.json tabBar['list'][${index}]['pagePath'] "${page.pagePath}"` }))
} }
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册