@dcloudio/vue-cli-plugin-uni 2.0.0-32920211029004 → 2.0.0-32920211122002
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/build.js +51 -9
- package/generator.js +4 -1
- package/lib/check-update.js +56 -0
- package/lib/configure-webpack.js +19 -4
- package/lib/env.js +8 -5
- package/lib/mp/index.js +9 -10
- package/package.json +3 -3
- package/packages/@vue/component-compiler-utils/MODIFY.md +5 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/API.md +873 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/CHANGELOG.md +466 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/LICENSE-MIT +22 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/README.md +49 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/index.js +26 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/parser.js +1088 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/processor.js +185 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/attribute.js +468 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/className.js +67 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/combinator.js +35 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/comment.js +35 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/constructors.js +91 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/container.js +392 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/guards.js +54 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/id.js +39 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/index.js +39 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/namespace.js +98 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/nesting.js +36 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/node.js +216 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/pseudo.js +40 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/root.js +60 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/selector.js +35 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/string.js +35 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/tag.js +35 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/types.js +15 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/universal.js +36 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/sortAscending.js +10 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/tokenTypes.js +39 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/tokenize.js +271 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/ensureObject.js +20 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/getProp.js +22 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/index.js +41 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/stripComments.js +21 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/unesc.js +18 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/package.json +76 -0
- package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts +499 -0
- package/packages/uni-cloud/dist/index.js +1 -1
package/commands/build.js
CHANGED
|
@@ -3,7 +3,9 @@ const path = require('path')
|
|
|
3
3
|
const {
|
|
4
4
|
runByHBuilderX,
|
|
5
5
|
isInHBuilderX,
|
|
6
|
-
parseJson
|
|
6
|
+
parseJson,
|
|
7
|
+
parsePagesJson,
|
|
8
|
+
parseManifestJson
|
|
7
9
|
} = require('@dcloudio/uni-cli-shared')
|
|
8
10
|
|
|
9
11
|
const uniI18n = require('@dcloudio/uni-cli-i18n')
|
|
@@ -32,7 +34,8 @@ module.exports = (api, options) => {
|
|
|
32
34
|
'--auto-host': 'specify automator host',
|
|
33
35
|
'--auto-port': 'specify automator port',
|
|
34
36
|
'--subpackage': 'specify subpackage',
|
|
35
|
-
'--plugin': 'specify plugin'
|
|
37
|
+
'--plugin': 'specify plugin',
|
|
38
|
+
'--manifest': 'build manifest.json'
|
|
36
39
|
}
|
|
37
40
|
}, async (args) => {
|
|
38
41
|
for (const key in defaults) {
|
|
@@ -41,7 +44,11 @@ module.exports = (api, options) => {
|
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
if (args.manifest && process.env.UNI_PLATFORM === 'app-plus') {
|
|
48
|
+
return buildManifestJson()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const platforms = ['mp-weixin', 'mp-qq', 'mp-baidu', 'mp-alipay', 'mp-toutiao', 'mp-lark']
|
|
45
52
|
if (args.subpackage && platforms.includes(process.env.UNI_PLATFORM)) {
|
|
46
53
|
process.env.UNI_SUBPACKGE = args.subpackage
|
|
47
54
|
}
|
|
@@ -135,7 +142,10 @@ async function build (args, api, options) {
|
|
|
135
142
|
log()
|
|
136
143
|
|
|
137
144
|
if (!runByHBuilderX && !runByAliIde) {
|
|
138
|
-
logWithSpinner(uniI18n.__('pluginUni.startCompileProjectToPlatform', {
|
|
145
|
+
logWithSpinner(uniI18n.__('pluginUni.startCompileProjectToPlatform', {
|
|
146
|
+
0: process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM,
|
|
147
|
+
1: process.env.UNI_MP_PLUGIN ? uniI18n.__('plugin') : uniI18n.__('platform')
|
|
148
|
+
}))
|
|
139
149
|
}
|
|
140
150
|
|
|
141
151
|
const targetDir = api.resolve(options.outputDir)
|
|
@@ -161,7 +171,8 @@ async function build (args, api, options) {
|
|
|
161
171
|
process.env.UNI_USING_V3_NATIVE ||
|
|
162
172
|
(process.UNI_NVUE_ENTRY && Object.keys(process.UNI_NVUE_ENTRY).length)
|
|
163
173
|
) {
|
|
164
|
-
webpackConfigs.push(require('@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js')(process
|
|
174
|
+
webpackConfigs.push(require('@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js')(process
|
|
175
|
+
.UNI_NVUE_ENTRY))
|
|
165
176
|
}
|
|
166
177
|
|
|
167
178
|
return new Promise((resolve, reject) => {
|
|
@@ -178,7 +189,8 @@ async function build (args, api, options) {
|
|
|
178
189
|
return reject('Build failed with errors.')
|
|
179
190
|
}
|
|
180
191
|
|
|
181
|
-
if (!args.silent && (process.env.UNI_PLATFORM !== 'app-plus' || process.env
|
|
192
|
+
if (!args.silent && (process.env.UNI_PLATFORM !== 'app-plus' || process.env
|
|
193
|
+
.UNI_AUTOMATOR_WS_ENDPOINT)) {
|
|
182
194
|
const targetDirShort = path.relative(
|
|
183
195
|
api.service.context,
|
|
184
196
|
process.env.UNI_OUTPUT_DIR
|
|
@@ -195,7 +207,8 @@ async function build (args, api, options) {
|
|
|
195
207
|
console.log('https://uniapp.dcloud.io/uniCloud/hosting')
|
|
196
208
|
}
|
|
197
209
|
} else {
|
|
198
|
-
const dirMsg = runByHBuilderX ? ''
|
|
210
|
+
const dirMsg = runByHBuilderX ? ''
|
|
211
|
+
: `The ${chalk.cyan(targetDirShort)} directory is ready. `
|
|
199
212
|
done(`Build complete. ${dirMsg}Watching for changes...`)
|
|
200
213
|
}
|
|
201
214
|
}
|
|
@@ -221,7 +234,9 @@ function analysisPluginDir () {
|
|
|
221
234
|
|
|
222
235
|
if (!fs.pathExistsSync(pluginJsonPath)) {
|
|
223
236
|
console.log()
|
|
224
|
-
console.error(uniI18n.__('pluginUni.fileNoExistsCheckAfterRetry', {
|
|
237
|
+
console.error(uniI18n.__('pluginUni.fileNoExistsCheckAfterRetry', {
|
|
238
|
+
0: pluginJsonName
|
|
239
|
+
}))
|
|
225
240
|
console.log()
|
|
226
241
|
process.exit(0)
|
|
227
242
|
}
|
|
@@ -235,8 +250,35 @@ function analysisPluginDir () {
|
|
|
235
250
|
|
|
236
251
|
if (UNI_MP_PLUGIN_MAIN && !fs.pathExistsSync(mainFilePath)) {
|
|
237
252
|
console.log()
|
|
238
|
-
console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', {
|
|
253
|
+
console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', {
|
|
254
|
+
0: UNI_MP_PLUGIN_MAIN
|
|
255
|
+
}))
|
|
239
256
|
console.log()
|
|
240
257
|
process.exit(0)
|
|
241
258
|
}
|
|
242
259
|
}
|
|
260
|
+
|
|
261
|
+
function buildManifestJson () {
|
|
262
|
+
const fs = require('fs-extra')
|
|
263
|
+
const inputDir = process.env.UNI_INPUT_DIR
|
|
264
|
+
const outputDir = process.env.UNI_OUTPUT_DIR
|
|
265
|
+
const pagesJsonPath = path.resolve(inputDir, 'pages.json')
|
|
266
|
+
const manifestJsonPath = path.resolve(inputDir, 'manifest.json')
|
|
267
|
+
|
|
268
|
+
const pagesJson = parsePagesJson(fs.readFileSync(pagesJsonPath, 'utf8'))
|
|
269
|
+
const manifestJson = parseManifestJson(fs.readFileSync(manifestJsonPath, 'utf8'))
|
|
270
|
+
|
|
271
|
+
const res = require('@dcloudio/webpack-uni-pages-loader/lib/platforms/app-plus/index.js')(pagesJson,
|
|
272
|
+
manifestJson,
|
|
273
|
+
false)
|
|
274
|
+
if (res && res[0]) {
|
|
275
|
+
fs.outputFileSync(
|
|
276
|
+
path.resolve(outputDir, 'manifest.json'),
|
|
277
|
+
res[0].content
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
const {
|
|
281
|
+
done
|
|
282
|
+
} = require('@vue/cli-shared-utils')
|
|
283
|
+
done('Build complete.')
|
|
284
|
+
}
|
package/generator.js
CHANGED
|
@@ -17,6 +17,7 @@ module.exports = (api, options, rootOptions) => {
|
|
|
17
17
|
'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch',
|
|
18
18
|
'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch',
|
|
19
19
|
'dev:mp-kuaishou': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch',
|
|
20
|
+
'dev:mp-lark': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch',
|
|
20
21
|
'dev:quickapp-native': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch',
|
|
21
22
|
'dev:quickapp-webview': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch',
|
|
22
23
|
'dev:quickapp-webview-huawei': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch',
|
|
@@ -28,6 +29,7 @@ module.exports = (api, options, rootOptions) => {
|
|
|
28
29
|
'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build',
|
|
29
30
|
'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build',
|
|
30
31
|
'build:mp-kuaishou': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build',
|
|
32
|
+
'build:mp-lark': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build',
|
|
31
33
|
'build:quickapp-native': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build',
|
|
32
34
|
'build:quickapp-webview': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build',
|
|
33
35
|
'build:quickapp-webview-huawei': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build',
|
|
@@ -54,6 +56,7 @@ module.exports = (api, options, rootOptions) => {
|
|
|
54
56
|
'@dcloudio/uni-mp-baidu': version,
|
|
55
57
|
'@dcloudio/uni-mp-alipay': version,
|
|
56
58
|
'@dcloudio/uni-mp-toutiao': version,
|
|
59
|
+
'@dcloudio/uni-mp-lark': version,
|
|
57
60
|
'@dcloudio/uni-mp-360': version,
|
|
58
61
|
'@dcloudio/uni-mp-kuaishou': version,
|
|
59
62
|
'@dcloudio/uni-quickapp-native': version,
|
|
@@ -85,4 +88,4 @@ module.exports = (api, options, rootOptions) => {
|
|
|
85
88
|
]
|
|
86
89
|
}
|
|
87
90
|
})
|
|
88
|
-
}
|
|
91
|
+
}
|
package/lib/check-update.js
CHANGED
|
@@ -13,6 +13,9 @@ class Upate {
|
|
|
13
13
|
this._isAlpha = false
|
|
14
14
|
this._uniId = ''
|
|
15
15
|
this._appId = ''
|
|
16
|
+
this._wt = 0
|
|
17
|
+
this._lc = ''
|
|
18
|
+
this._lcin = []
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
get uniId () {
|
|
@@ -47,6 +50,30 @@ class Upate {
|
|
|
47
50
|
this._isAlpha = value
|
|
48
51
|
}
|
|
49
52
|
|
|
53
|
+
get wt () {
|
|
54
|
+
return this._wt
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
set wt (value) {
|
|
58
|
+
this._wt = value
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get lc () {
|
|
62
|
+
return this._lc
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
set lc (value) {
|
|
66
|
+
this._lc = value
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get lcin () {
|
|
70
|
+
return this._lcin
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
set lcin (value) {
|
|
74
|
+
this._lcin = value
|
|
75
|
+
}
|
|
76
|
+
|
|
50
77
|
get versionType () {
|
|
51
78
|
return (this.isAlpha ? 'a' : 'r')
|
|
52
79
|
}
|
|
@@ -156,6 +183,9 @@ class Upate {
|
|
|
156
183
|
data.appid = this.uniId
|
|
157
184
|
data.vtype = this.versionType
|
|
158
185
|
data.vcode = this.compilerVersion
|
|
186
|
+
data.wt = this._wt
|
|
187
|
+
data.lc = this._lc
|
|
188
|
+
data.in = this._lcin
|
|
159
189
|
|
|
160
190
|
delete data.lastCheck
|
|
161
191
|
|
|
@@ -234,6 +264,28 @@ Object.assign(Upate.prototype, {
|
|
|
234
264
|
DEFAULT_INTERVAL: 1000 * 60 * 60 * 24
|
|
235
265
|
})
|
|
236
266
|
|
|
267
|
+
function getLc () {
|
|
268
|
+
const result = []
|
|
269
|
+
const localeDir = path.join(process.env.UNI_CLI_CONTEXT, 'src/locale')
|
|
270
|
+
if (!fs.existsSync(localeDir)) {
|
|
271
|
+
return result
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const files = fs.readdirSync(localeDir)
|
|
275
|
+
for (let i = files.length - 1; i >= 0; i--) {
|
|
276
|
+
const filePath = files[i]
|
|
277
|
+
const extName = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase()
|
|
278
|
+
if (extName !== 'json') {
|
|
279
|
+
continue
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (files[i].indexOf('uni-app.') < 0) {
|
|
283
|
+
result.push(filePath.substring(0, filePath.lastIndexOf('.')))
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return result
|
|
287
|
+
}
|
|
288
|
+
|
|
237
289
|
module.exports = async function checkUpdate () {
|
|
238
290
|
const {
|
|
239
291
|
isInHBuilderX,
|
|
@@ -255,6 +307,10 @@ module.exports = async function checkUpdate () {
|
|
|
255
307
|
update.uniId = manifest.appid
|
|
256
308
|
const appIdKey = process.env.UNI_PLATFORM.includes('quickapp') ? 'package' : 'appid'
|
|
257
309
|
update.appId = manifest[process.env.UNI_PLATFORM] ? (manifest[process.env.UNI_PLATFORM][appIdKey] || '') : ''
|
|
310
|
+
const cf = manifest['mp-weixin'] ? manifest['mp-weixin'].cloudfunctionRoot : ''
|
|
311
|
+
update.wt = (cf && cf.length) ? 1 : 0
|
|
312
|
+
update.lc = manifest.locale ? manifest.locale : ''
|
|
313
|
+
update.lcin = getLc().join(',')
|
|
258
314
|
update.check()
|
|
259
315
|
} catch (e) {
|
|
260
316
|
}
|
package/lib/configure-webpack.js
CHANGED
|
@@ -15,7 +15,7 @@ function resolve (dir) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function resolveModule (dir) {
|
|
18
|
-
return path.resolve(
|
|
18
|
+
return path.resolve(process.env.UNI_CLI_CONTEXT, './node_modules', dir)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
module.exports = function configureWebpack (platformOptions, manifestPlatformOptions, vueOptions, api) {
|
|
@@ -184,8 +184,9 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
|
|
|
184
184
|
platformWebpackConfig = platformWebpackConfig(webpackConfig, vueOptions, api)
|
|
185
185
|
}
|
|
186
186
|
// 移除 node_modules 目录,避免受路径上的 node_modules 影响
|
|
187
|
-
|
|
188
|
-
'node_modules')
|
|
187
|
+
if (require('@dcloudio/uni-cli-shared/lib/util').isInHBuilderX) {
|
|
188
|
+
webpackConfig.resolve.modules = webpackConfig.resolve.modules.filter(module => module !== 'node_modules')
|
|
189
|
+
}
|
|
189
190
|
|
|
190
191
|
const plugins = []
|
|
191
192
|
|
|
@@ -298,6 +299,17 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
|
|
|
298
299
|
}
|
|
299
300
|
} catch (e) {}
|
|
300
301
|
|
|
302
|
+
const resolveLoaderAlias = {}
|
|
303
|
+
const modules = ['@vue/cli-plugin-babel', '@vue/cli-service']
|
|
304
|
+
modules.forEach(m => {
|
|
305
|
+
const { dependencies } = require(`${m}/package.json`)
|
|
306
|
+
Object.keys(dependencies).forEach(key => {
|
|
307
|
+
if (/-loader$/.test(key)) {
|
|
308
|
+
resolveLoaderAlias[key] = require.resolve(key)
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
|
|
301
313
|
return merge({
|
|
302
314
|
devtool: false,
|
|
303
315
|
resolve: {
|
|
@@ -325,6 +337,9 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
|
|
|
325
337
|
noParse: /^(vue|vue-router|vuex|vuex-router-sync)$/,
|
|
326
338
|
rules
|
|
327
339
|
},
|
|
340
|
+
resolveLoader: {
|
|
341
|
+
alias: resolveLoaderAlias
|
|
342
|
+
},
|
|
328
343
|
plugins,
|
|
329
344
|
performance: {
|
|
330
345
|
assetFilter (assetFilename) {
|
|
@@ -334,4 +349,4 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
|
|
|
334
349
|
watchOptions: require('./util').getWatchOptions()
|
|
335
350
|
}, platformWebpackConfig)
|
|
336
351
|
}
|
|
337
|
-
}
|
|
352
|
+
}
|
package/lib/env.js
CHANGED
|
@@ -49,6 +49,9 @@ process.env.UNI_USING_V3_SCOPED = true
|
|
|
49
49
|
|
|
50
50
|
process.env.UNI_CLOUD_PROVIDER = JSON.stringify([])
|
|
51
51
|
|
|
52
|
+
// 导出到小程序插件
|
|
53
|
+
process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(Object.keys(platformOptions.plugins || {}).map(pluginName => platformOptions.plugins[pluginName].export))
|
|
54
|
+
|
|
52
55
|
const isH5 = !process.env.UNI_SUB_PLATFORM && process.env.UNI_PLATFORM === 'h5'
|
|
53
56
|
const isProduction = process.env.NODE_ENV === 'production'
|
|
54
57
|
|
|
@@ -104,11 +107,13 @@ if (process.env.UNI_CLOUD_SPACES) {
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
// 初始化环境变量
|
|
107
|
-
|
|
110
|
+
process.env.UNI_CLI_CONTEXT = require('@dcloudio/uni-cli-shared/lib/util').getCLIContext()
|
|
111
|
+
|
|
112
|
+
const defaultOutputDir = './dist/' +
|
|
108
113
|
(process.env.NODE_ENV === 'production' ? 'build' : 'dev') + '/' +
|
|
109
114
|
(process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM)
|
|
110
115
|
|
|
111
|
-
process.env.UNI_OUTPUT_DEFAULT_DIR = path.resolve(
|
|
116
|
+
process.env.UNI_OUTPUT_DEFAULT_DIR = path.resolve(process.env.UNI_CLI_CONTEXT, defaultOutputDir)
|
|
112
117
|
if (process.env.UNI_OUTPUT_DIR && process.env.UNI_OUTPUT_DIR.indexOf('./') === 0) {
|
|
113
118
|
process.env.UNI_OUTPUT_DIR = path.resolve(process.cwd(), process.env.UNI_OUTPUT_DIR)
|
|
114
119
|
}
|
|
@@ -121,8 +126,6 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
|
|
|
121
126
|
process.env.UNI_OUTPUT_TMP_DIR = path.resolve(process.env.UNI_OUTPUT_DIR, '../.tmp/app-plus')
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
process.env.UNI_CLI_CONTEXT = path.resolve(__dirname, '../../../../')
|
|
125
|
-
|
|
126
129
|
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
|
|
127
130
|
|
|
128
131
|
if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
|
|
@@ -410,7 +413,7 @@ if (process.env.UNI_PLATFORM === 'h5') {
|
|
|
410
413
|
moduleAlias.addAlias('vue-style-loader', '@dcloudio/vue-cli-plugin-uni/packages/h5-vue-style-loader')
|
|
411
414
|
}
|
|
412
415
|
|
|
413
|
-
if (process.env.UNI_PLATFORM === 'mp-toutiao') {
|
|
416
|
+
if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
|
|
414
417
|
// !important 始终带有一个空格
|
|
415
418
|
moduleAlias.addAlias(
|
|
416
419
|
'postcss-normalize-whitespace',
|
package/lib/mp/index.js
CHANGED
|
@@ -138,6 +138,10 @@ function initSubpackageConfig (webpackConfig, vueOptions) {
|
|
|
138
138
|
webpackConfig.output.jsonpFunction('webpackJsonp_' + (process.env.UNI_SUBPACKGE || process.env.UNI_MP_PLUGIN))
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
function addToUniEntry (fileName) {
|
|
142
|
+
fileName && (process.UNI_ENTRY[fileName.split('.')[0]] = path.resolve(process.env.UNI_INPUT_DIR, fileName))
|
|
143
|
+
}
|
|
144
|
+
|
|
141
145
|
module.exports = {
|
|
142
146
|
vueConfig: {
|
|
143
147
|
parallel: false
|
|
@@ -171,16 +175,11 @@ module.exports = {
|
|
|
171
175
|
plugins.push(new PreprocessAssetsPlugin())
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const UNI_MP_PLUGIN_MAIN = process.env.UNI_MP_PLUGIN_MAIN
|
|
180
|
-
if (UNI_MP_PLUGIN_MAIN) {
|
|
181
|
-
process.UNI_ENTRY[UNI_MP_PLUGIN_MAIN.split('.')[0]] = path.resolve(process.env.UNI_INPUT_DIR,
|
|
182
|
-
UNI_MP_PLUGIN_MAIN)
|
|
183
|
-
}
|
|
178
|
+
{
|
|
179
|
+
const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'
|
|
180
|
+
;[].concat(process.env.UNI_MP_PLUGIN ? process.env.UNI_MP_PLUGIN_MAIN : JSON.parse(process.env.UNI_MP_PLUGIN_EXPORT))
|
|
181
|
+
.forEach(fileName => addToUniEntry(fileName))
|
|
182
|
+
beforeCode += `${globalEnv}.__webpack_require_${(process.env.UNI_MP_PLUGIN || 'UNI_MP_PLUGIN').replace(/-/g, '_')}__ = __webpack_require__;`
|
|
184
183
|
}
|
|
185
184
|
|
|
186
185
|
const alias = { // 仅 mp-weixin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vue-cli-plugin-uni",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-32920211122002",
|
|
4
4
|
"description": "uni-app plugin for vue-cli 3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "fxy060608",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dcloudio/uni-stat": "^2.0.0-
|
|
20
|
+
"@dcloudio/uni-stat": "^2.0.0-32920211122002",
|
|
21
21
|
"buffer-json": "^2.0.0",
|
|
22
22
|
"copy-webpack-plugin": "^5.1.1",
|
|
23
23
|
"cross-env": "^5.2.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"wrap-loader": "^0.2.0",
|
|
38
38
|
"xregexp": "4.0.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "50f495a0cd39cbd1828bce77572913855cabd0df"
|
|
41
41
|
}
|