@dcloudio/vue-cli-plugin-hbuilderx 2.0.1-35320220729002 → 2.0.1-36220220914001
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/build/css-loader.conf.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
|
+
const webpack = require('webpack')
|
|
3
4
|
|
|
4
5
|
const {
|
|
5
6
|
getPlatformScss,
|
|
@@ -7,10 +8,6 @@ const {
|
|
|
7
8
|
nvueCssPreprocessOptions
|
|
8
9
|
} = require('@dcloudio/uni-cli-shared')
|
|
9
10
|
|
|
10
|
-
const {
|
|
11
|
-
sassLoaderVersion
|
|
12
|
-
} = require('@dcloudio/uni-cli-shared/lib/scss')
|
|
13
|
-
|
|
14
11
|
const nvueStyleLoader = {
|
|
15
12
|
loader: '@dcloudio/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/style'
|
|
16
13
|
}
|
|
@@ -20,27 +17,33 @@ const preprocessLoader = {
|
|
|
20
17
|
options: nvueCssPreprocessOptions
|
|
21
18
|
}
|
|
22
19
|
|
|
20
|
+
const options = {
|
|
21
|
+
sourceMap: false
|
|
22
|
+
}
|
|
23
|
+
const plugins = [
|
|
24
|
+
require('postcss-import')({
|
|
25
|
+
resolve (id, basedir, importOptions) {
|
|
26
|
+
if (id.startsWith('~@/')) {
|
|
27
|
+
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
|
|
28
|
+
} else if (id.startsWith('@/')) {
|
|
29
|
+
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
|
|
30
|
+
} else if (id.startsWith('/') && !id.startsWith('//')) {
|
|
31
|
+
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
|
|
32
|
+
}
|
|
33
|
+
return id
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
|
|
37
|
+
]
|
|
38
|
+
if (webpack.version[0] > 4) {
|
|
39
|
+
options.postcssOptions = { plugins }
|
|
40
|
+
} else {
|
|
41
|
+
options.parser = require('postcss-comment')
|
|
42
|
+
options.plugins = plugins
|
|
43
|
+
}
|
|
23
44
|
const postcssLoader = {
|
|
24
45
|
loader: 'postcss-loader',
|
|
25
|
-
options
|
|
26
|
-
sourceMap: false,
|
|
27
|
-
parser: require('postcss-comment'),
|
|
28
|
-
plugins: [
|
|
29
|
-
require('postcss-import')({
|
|
30
|
-
resolve (id, basedir, importOptions) {
|
|
31
|
-
if (id.startsWith('~@/')) {
|
|
32
|
-
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
|
|
33
|
-
} else if (id.startsWith('@/')) {
|
|
34
|
-
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
|
|
35
|
-
} else if (id.startsWith('/') && !id.startsWith('//')) {
|
|
36
|
-
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
|
|
37
|
-
}
|
|
38
|
-
return id
|
|
39
|
-
}
|
|
40
|
-
}),
|
|
41
|
-
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
|
|
42
|
-
]
|
|
43
|
-
}
|
|
46
|
+
options
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
// sass 全局变量
|
|
@@ -71,25 +74,15 @@ const sassLoader = {
|
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
sassLoader.options.data = sassData
|
|
79
|
-
sassLoader.options.outputStyle = 'expanded'
|
|
80
|
-
sassLoader.options.indentedSyntax = true
|
|
81
|
-
} else {
|
|
82
|
-
const name = sassLoaderVersion >= 9 ? 'additionalData' : 'prependData'
|
|
83
|
-
scssLoader.options[name] = sassData
|
|
84
|
-
scssLoader.options.sassOptions = {
|
|
85
|
-
outputStyle: 'expanded'
|
|
86
|
-
}
|
|
77
|
+
scssLoader.options.prependData = sassData
|
|
78
|
+
scssLoader.options.sassOptions = {
|
|
79
|
+
outputStyle: 'expanded'
|
|
80
|
+
}
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
82
|
+
sassLoader.options.prependData = sassData
|
|
83
|
+
sassLoader.options.sassOptions = {
|
|
84
|
+
outputStyle: 'expanded',
|
|
85
|
+
indentedSyntax: true
|
|
93
86
|
}
|
|
94
87
|
|
|
95
88
|
const lessLoader = {
|
|
@@ -143,4 +136,4 @@ module.exports = [{
|
|
|
143
136
|
}, {
|
|
144
137
|
test: /\.styl(us)?$/,
|
|
145
138
|
oneOf: createOneOf(stylusLoader)
|
|
146
|
-
}]
|
|
139
|
+
}]
|
|
@@ -3,6 +3,7 @@ const path = require('path')
|
|
|
3
3
|
const webpack = require('webpack')
|
|
4
4
|
const VueLoaderPlugin = require('@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/plugin')
|
|
5
5
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
6
|
+
const CopyWebpackPluginVersion = Number(require('copy-webpack-plugin/package.json').version.split('.')[0])
|
|
6
7
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
7
8
|
|
|
8
9
|
const {
|
|
@@ -12,6 +13,12 @@ const {
|
|
|
12
13
|
getTemplatePath
|
|
13
14
|
} = require('@dcloudio/uni-cli-shared')
|
|
14
15
|
const fileLoader = require('@dcloudio/uni-cli-shared/lib/file-loader')
|
|
16
|
+
const {
|
|
17
|
+
compileI18nJsonStr
|
|
18
|
+
} = require('@dcloudio/uni-i18n')
|
|
19
|
+
const {
|
|
20
|
+
initI18nOptions
|
|
21
|
+
} = require('@dcloudio/uni-cli-shared/lib/i18n')
|
|
15
22
|
const WebpackAppPlusNVuePlugin = process.env.UNI_USING_V3
|
|
16
23
|
? require('../packages/webpack-app-plus-plugin')
|
|
17
24
|
: require('../packages/webpack-app-plus-nvue-plugin')
|
|
@@ -88,7 +95,9 @@ const plugins = [
|
|
|
88
95
|
RUN_BY_HBUILDERX: process.env.RUN_BY_HBUILDERX,
|
|
89
96
|
UNI_AUTOMATOR_WS_ENDPOINT: JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT),
|
|
90
97
|
UNI_STAT_UNI_CLOUD: process.env.UNI_STAT_UNI_CLOUD || '""',
|
|
91
|
-
|
|
98
|
+
UNI_STATISTICS_CONFIG: process.env.UNI_STATISTICS_CONFIG || '""',
|
|
99
|
+
UNI_STAT_DEBUG: process.env.UNI_STAT_DEBUG || '""',
|
|
100
|
+
UNI_COMPILER_VERSION: JSON.stringify(process.env.UNI_COMPILER_VERSION)
|
|
92
101
|
}
|
|
93
102
|
}),
|
|
94
103
|
new webpack.BannerPlugin({
|
|
@@ -110,7 +119,10 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
110
119
|
|
|
111
120
|
// const excludeModuleReg = /node_modules(?!(\/|\\).*(weex).*)/
|
|
112
121
|
|
|
113
|
-
const rules = [{
|
|
122
|
+
const rules = [webpack.version[0] > 4 ? {
|
|
123
|
+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/i,
|
|
124
|
+
type: 'asset'
|
|
125
|
+
} : {
|
|
114
126
|
test: /\.(png|jpg|gif|ttf|eot|woff|woff2)$/i,
|
|
115
127
|
use: [fileLoader]
|
|
116
128
|
}, {
|
|
@@ -192,7 +204,7 @@ rules.unshift({
|
|
|
192
204
|
if (process.env.UNI_USING_V3_NATIVE) {
|
|
193
205
|
try {
|
|
194
206
|
const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json')
|
|
195
|
-
|
|
207
|
+
const patterns = [{
|
|
196
208
|
from: automatorJson,
|
|
197
209
|
to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) +
|
|
198
210
|
'/.automator.json',
|
|
@@ -205,31 +217,46 @@ if (process.env.UNI_USING_V3_NATIVE) {
|
|
|
205
217
|
}
|
|
206
218
|
return ''
|
|
207
219
|
}
|
|
208
|
-
}]
|
|
209
|
-
|
|
220
|
+
}]
|
|
221
|
+
plugins.push(new CopyWebpackPlugin(CopyWebpackPluginVersion > 5 ? { patterns } : patterns))
|
|
222
|
+
} catch (e) { }
|
|
210
223
|
}
|
|
211
224
|
|
|
212
225
|
if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
|
|
213
226
|
plugins.push(new WebpackUniMPPlugin())
|
|
214
227
|
const assetsDir = 'static'
|
|
215
228
|
const hybridDir = 'hybrid/html'
|
|
216
|
-
const
|
|
229
|
+
const patterns = [{
|
|
217
230
|
from: path.resolve(process.env.UNI_INPUT_DIR, assetsDir),
|
|
218
231
|
to: assetsDir
|
|
219
232
|
}]
|
|
220
233
|
// 自动化测试时,不启用androidPrivacy.json
|
|
221
234
|
if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
235
|
+
const fileName = 'androidPrivacy.json'
|
|
236
|
+
const context = path.resolve(process.env.UNI_INPUT_DIR)
|
|
237
|
+
if (fs.existsSync(path.join(context, fileName))) {
|
|
238
|
+
patterns.push({
|
|
239
|
+
from: fileName,
|
|
240
|
+
context,
|
|
241
|
+
to: fileName,
|
|
242
|
+
transform (content) {
|
|
243
|
+
const options = initI18nOptions(
|
|
244
|
+
process.env.UNI_PLATFORM,
|
|
245
|
+
process.env.UNI_INPUT_DIR,
|
|
246
|
+
false,
|
|
247
|
+
true
|
|
248
|
+
)
|
|
249
|
+
if (!options) {
|
|
250
|
+
return content
|
|
251
|
+
}
|
|
252
|
+
return compileI18nJsonStr(content.toString(), options)
|
|
253
|
+
}
|
|
227
254
|
})
|
|
228
255
|
}
|
|
229
256
|
}
|
|
230
257
|
const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, hybridDir)
|
|
231
258
|
if (fs.existsSync(hybridHtmlPath)) {
|
|
232
|
-
|
|
259
|
+
patterns.push({
|
|
233
260
|
from: hybridHtmlPath,
|
|
234
261
|
to: hybridDir
|
|
235
262
|
})
|
|
@@ -240,7 +267,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
|
|
|
240
267
|
const assets = modules + module + '/' + assetsDir
|
|
241
268
|
const assetsPath = path.resolve(process.env.UNI_INPUT_DIR, assets)
|
|
242
269
|
if (fs.existsSync(assetsPath)) {
|
|
243
|
-
|
|
270
|
+
patterns.push({
|
|
244
271
|
from: assetsPath,
|
|
245
272
|
to: assets
|
|
246
273
|
})
|
|
@@ -248,7 +275,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
|
|
|
248
275
|
const hybridHtml = modules + module + '/' + hybridDir
|
|
249
276
|
const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, hybridHtml)
|
|
250
277
|
if (fs.existsSync(hybridHtmlPath)) {
|
|
251
|
-
|
|
278
|
+
patterns.push({
|
|
252
279
|
from: hybridHtmlPath,
|
|
253
280
|
to: hybridHtml
|
|
254
281
|
})
|
|
@@ -256,12 +283,12 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
|
|
|
256
283
|
})
|
|
257
284
|
|
|
258
285
|
if (process.env.UNI_USING_NVUE_COMPILER) {
|
|
259
|
-
|
|
286
|
+
patterns.push({
|
|
260
287
|
from: path.resolve(getTemplatePath(), 'common'),
|
|
261
288
|
to: process.env.UNI_OUTPUT_DIR
|
|
262
289
|
})
|
|
263
290
|
} else if (process.env.UNI_USING_V3_NATIVE) {
|
|
264
|
-
|
|
291
|
+
patterns.push({
|
|
265
292
|
from: path.resolve(getTemplatePath(), 'weex'),
|
|
266
293
|
to: process.env.UNI_OUTPUT_DIR
|
|
267
294
|
})
|
|
@@ -273,7 +300,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
|
|
|
273
300
|
'weapp-tools/template/v8'
|
|
274
301
|
)
|
|
275
302
|
}
|
|
276
|
-
|
|
303
|
+
patterns.push({
|
|
277
304
|
from: nativeTemplatePath,
|
|
278
305
|
to: process.env.UNI_OUTPUT_DIR
|
|
279
306
|
}, {
|
|
@@ -282,15 +309,17 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
|
|
|
282
309
|
'weapp-tools/template/common'
|
|
283
310
|
),
|
|
284
311
|
to: process.env.UNI_OUTPUT_DIR,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
312
|
+
globOptions: {
|
|
313
|
+
ignore: [
|
|
314
|
+
'*.js',
|
|
315
|
+
'*.json',
|
|
316
|
+
'__uniapppicker.html',
|
|
317
|
+
'__uniappview.html'
|
|
318
|
+
]
|
|
319
|
+
}
|
|
291
320
|
})
|
|
292
321
|
}
|
|
293
|
-
plugins.push(new CopyWebpackPlugin(
|
|
322
|
+
plugins.push(new CopyWebpackPlugin(CopyWebpackPluginVersion > 5 ? { patterns } : patterns))
|
|
294
323
|
}
|
|
295
324
|
|
|
296
325
|
try {
|
|
@@ -303,7 +332,7 @@ try {
|
|
|
303
332
|
dir: process.env.UNI_INPUT_DIR
|
|
304
333
|
}))
|
|
305
334
|
}
|
|
306
|
-
} catch (e) {}
|
|
335
|
+
} catch (e) { }
|
|
307
336
|
|
|
308
337
|
module.exports = function () {
|
|
309
338
|
return {
|
|
@@ -320,8 +349,7 @@ module.exports = function () {
|
|
|
320
349
|
performance: {
|
|
321
350
|
hints: false
|
|
322
351
|
},
|
|
323
|
-
optimization: {
|
|
324
|
-
namedModules: false,
|
|
352
|
+
optimization: Object.assign({
|
|
325
353
|
minimizer: [
|
|
326
354
|
new TerserPlugin({
|
|
327
355
|
terserOptions: {
|
|
@@ -331,7 +359,7 @@ module.exports = function () {
|
|
|
331
359
|
}
|
|
332
360
|
})
|
|
333
361
|
]
|
|
334
|
-
},
|
|
362
|
+
}, webpack.version[0] > 4 ? {} : { namedModules: false }),
|
|
335
363
|
output: {
|
|
336
364
|
path: process.env.UNI_OUTPUT_DIR,
|
|
337
365
|
filename: '[name].js'
|
|
@@ -375,7 +403,7 @@ module.exports = function () {
|
|
|
375
403
|
reasons: true,
|
|
376
404
|
errorDetails: true
|
|
377
405
|
},
|
|
378
|
-
node: {
|
|
406
|
+
node: webpack.version[0] > 4 ? false : {
|
|
379
407
|
global: false,
|
|
380
408
|
Buffer: false,
|
|
381
409
|
__filename: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vue-cli-plugin-hbuilderx",
|
|
3
|
-
"version": "2.0.1-
|
|
3
|
+
"version": "2.0.1-36220220914001",
|
|
4
4
|
"description": "HBuilderX plugin for vue-cli 3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"css": "~2.2.1",
|
|
19
19
|
"escodegen": "^1.8.1"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "67fdc447148dd3e05d528bfb4e5ed103430ec05b"
|
|
22
22
|
}
|
|
@@ -14,13 +14,10 @@ class WebpackAppPlusNVuePlugin {
|
|
|
14
14
|
const changedFiles = []
|
|
15
15
|
compiler.hooks.emit.tapAsync('webpack-uni-nvue', (compilation, callback) => {
|
|
16
16
|
changedFiles.length = 0
|
|
17
|
-
|
|
17
|
+
compilation.chunks.forEach(chunk => {
|
|
18
18
|
const oldVersion = chunkVersions[chunk.name]
|
|
19
19
|
chunkVersions[chunk.name] = chunk.hash
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
changedChunks.map(chunk => {
|
|
23
|
-
if (Array.isArray(chunk.files)) {
|
|
20
|
+
if (chunk.hash !== oldVersion && Array.isArray(chunk.files)) {
|
|
24
21
|
chunk.files.forEach(file => {
|
|
25
22
|
!changedFiles.includes(file) && (changedFiles.push(file))
|
|
26
23
|
})
|
|
@@ -44,13 +44,10 @@ class WebpackAppPlusPlugin {
|
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
compiler.hooks.emit.tapAsync('WebpackAppPlusPlugin', (compilation, callback) => {
|
|
47
|
-
|
|
47
|
+
compilation.chunks.forEach(chunk => {
|
|
48
48
|
const oldVersion = chunkVersions[chunk.name]
|
|
49
49
|
chunkVersions[chunk.name] = chunk.hash
|
|
50
|
-
|
|
51
|
-
})
|
|
52
|
-
changedChunks.map(chunk => {
|
|
53
|
-
if (Array.isArray(chunk.files)) {
|
|
50
|
+
if (chunk.hash !== oldVersion && Array.isArray(chunk.files)) {
|
|
54
51
|
chunk.files.forEach(file => {
|
|
55
52
|
if (isAppService) {
|
|
56
53
|
!serviceChangedFiles.includes(file) && (serviceChangedFiles.push(file))
|