@mpxjs/webpack-plugin 2.6.114-alpha.8 → 2.6.115
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/README.md +1 -1
- package/lib/built-in-loader.js +49 -0
- package/lib/config.js +0 -14
- package/lib/content-loader.js +13 -0
- package/lib/dependency/ChildCompileDependency.js +24 -0
- package/lib/dependency/InjectDependency.js +26 -0
- package/lib/dependency/RemovedModuleDependency.js +23 -0
- package/lib/{dependencies → dependency}/ReplaceDependency.js +2 -19
- package/lib/dependency/ResolveDependency.js +49 -0
- package/lib/extractor.js +178 -82
- package/lib/file-loader.js +19 -7
- package/lib/helpers.js +334 -39
- package/lib/index.js +525 -889
- package/lib/json-compiler/index.js +451 -245
- package/lib/json-compiler/{theme.js → theme-loader.js} +3 -5
- package/lib/loader.js +241 -178
- package/lib/native-loader.js +133 -71
- package/lib/parser.js +2 -1
- package/lib/path-loader.js +3 -0
- package/lib/platform/json/wx/index.js +1 -1
- package/lib/platform/template/normalize-component-rules.js +3 -2
- package/lib/platform/template/wx/component-config/button.js +2 -14
- package/lib/platform/template/wx/component-config/image.js +0 -4
- package/lib/platform/template/wx/component-config/input.js +0 -4
- package/lib/platform/template/wx/component-config/rich-text.js +0 -4
- package/lib/platform/template/wx/component-config/scroll-view.js +0 -4
- package/lib/platform/template/wx/component-config/switch.js +0 -4
- package/lib/platform/template/wx/component-config/text.js +0 -4
- package/lib/platform/template/wx/component-config/textarea.js +0 -5
- package/lib/platform/template/wx/component-config/view.js +0 -4
- package/lib/platform/template/wx/index.js +3 -149
- package/lib/plugin-loader.js +287 -0
- package/lib/resolver/AddEnvPlugin.js +3 -4
- package/lib/resolver/AddModePlugin.js +3 -4
- package/lib/resolver/PackageEntryPlugin.js +36 -23
- package/lib/runtime/base.styl +0 -5
- package/lib/runtime/components/web/getInnerListeners.js +3 -1
- package/lib/runtime/components/web/mpx-image.vue +5 -20
- package/lib/runtime/components/web/mpx-movable-view.vue +2 -6
- package/lib/runtime/components/web/mpx-swiper.vue +3 -18
- package/lib/runtime/i18n.wxs +11 -31
- package/lib/runtime/optionProcessor.js +3 -48
- package/lib/selector.js +10 -29
- package/lib/staticConfig.js +4 -0
- package/lib/style-compiler/index.js +24 -16
- package/lib/style-compiler/load-postcss-config.js +1 -3
- package/lib/style-compiler/plugins/conditional-strip.js +65 -68
- package/lib/style-compiler/plugins/rpx.js +37 -43
- package/lib/style-compiler/plugins/scope-id.js +72 -79
- package/lib/style-compiler/plugins/trans-special.js +18 -25
- package/lib/style-compiler/plugins/trim.js +7 -13
- package/lib/style-compiler/plugins/vw.js +16 -22
- package/lib/template-compiler/compiler.js +199 -106
- package/lib/template-compiler/index.js +139 -52
- package/lib/template-compiler/trans-dynamic-class-expr.js +13 -18
- package/lib/url-loader.js +29 -11
- package/lib/utils/add-query.js +1 -1
- package/lib/utils/get-main-compilation.js +6 -0
- package/lib/utils/is-url-request.js +1 -10
- package/lib/utils/match-condition.js +1 -4
- package/lib/utils/normalize.js +15 -4
- package/lib/utils/parse-request.js +3 -3
- package/lib/utils/read-json-for-src.js +34 -0
- package/lib/utils/stringify-query.js +0 -4
- package/lib/utils/try-require.js +16 -0
- package/lib/web/processJSON.js +144 -113
- package/lib/web/processScript.js +34 -47
- package/lib/web/processTemplate.js +40 -57
- package/lib/wxml/{loader.js → wxml-loader.js} +62 -21
- package/lib/wxs/WxsParserPlugin.js +2 -2
- package/lib/wxs/WxsPlugin.js +8 -4
- package/lib/wxs/WxsTemplatePlugin.js +92 -46
- package/lib/wxs/{i18n-loader.js → wxs-i18n-loader.js} +4 -5
- package/lib/wxs/wxs-loader.js +117 -0
- package/lib/wxs/{pre-loader.js → wxs-pre-loader.js} +5 -20
- package/lib/wxss/getImportPrefix.js +30 -0
- package/lib/wxss/loader.js +43 -31
- package/lib/wxss/localsLoader.js +5 -1
- package/lib/wxss/processCss.js +103 -107
- package/package.json +18 -21
- package/LICENSE +0 -433
- package/lib/dependencies/AddEntryDependency.js +0 -24
- package/lib/dependencies/AppEntryDependency.js +0 -58
- package/lib/dependencies/CommonJsAsyncDependency.js +0 -51
- package/lib/dependencies/CommonJsVariableDependency.js +0 -81
- package/lib/dependencies/DynamicEntryDependency.js +0 -171
- package/lib/dependencies/FlagPluginDependency.js +0 -24
- package/lib/dependencies/InjectDependency.js +0 -43
- package/lib/dependencies/RecordGlobalComponentsDependency.js +0 -50
- package/lib/dependencies/RecordIndependentDependency.js +0 -44
- package/lib/dependencies/RecordResourceMapDependency.js +0 -62
- package/lib/dependencies/RemoveEntryDependency.js +0 -40
- package/lib/dependencies/ResolveDependency.js +0 -88
- package/lib/independent-loader.js +0 -52
- package/lib/json-compiler/helper.js +0 -156
- package/lib/json-compiler/plugin.js +0 -150
- package/lib/partial-compile/index.js +0 -35
- package/lib/record-loader.js +0 -11
- package/lib/resolve-loader.js +0 -6
- package/lib/resolver/FixDescriptionInfoPlugin.js +0 -28
- package/lib/runtime/components/tenon/getInnerListeners.js +0 -317
- package/lib/runtime/components/tenon/tenon-button.vue +0 -305
- package/lib/runtime/components/tenon/tenon-image.vue +0 -61
- package/lib/runtime/components/tenon/tenon-input.vue +0 -99
- package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -21
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -124
- package/lib/runtime/components/tenon/tenon-switch.vue +0 -91
- package/lib/runtime/components/tenon/tenon-text-area.vue +0 -64
- package/lib/runtime/components/tenon/tenon-text.vue +0 -64
- package/lib/runtime/components/tenon/tenon-view.vue +0 -93
- package/lib/runtime/components/tenon/util.js +0 -44
- package/lib/runtime/optionProcessor.tenon.js +0 -386
- package/lib/style-compiler/plugins/hm.js +0 -20
- package/lib/tenon/index.js +0 -105
- package/lib/tenon/processJSON.js +0 -360
- package/lib/tenon/processScript.js +0 -260
- package/lib/tenon/processStyles.js +0 -21
- package/lib/tenon/processTemplate.js +0 -133
- package/lib/utils/const.js +0 -10
- package/lib/utils/emit-file.js +0 -10
- package/lib/utils/eval-json-js.js +0 -31
- package/lib/utils/get-entry-name.js +0 -13
- package/lib/utils/get-json-content.js +0 -42
- package/lib/utils/get-relative-path.js +0 -24
- package/lib/utils/resolve.js +0 -13
- package/lib/utils/set.js +0 -47
- package/lib/utils/stringify-loaders-resource.js +0 -25
- package/lib/wxs/WxsModuleIdsPlugin.js +0 -29
- package/lib/wxs/loader.js +0 -142
|
@@ -10,7 +10,7 @@ const normalize = require('../../../utils/normalize')
|
|
|
10
10
|
|
|
11
11
|
module.exports = function getSpec ({ warn, error }) {
|
|
12
12
|
const spec = {
|
|
13
|
-
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd'
|
|
13
|
+
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd'],
|
|
14
14
|
// props预处理
|
|
15
15
|
preProps: [],
|
|
16
16
|
// props后处理
|
|
@@ -24,15 +24,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
24
24
|
value: parsed.result
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
tenon ({ name, value }) {
|
|
29
|
-
const parsed = parseMustache(value)
|
|
30
|
-
if (parsed.hasBinding) {
|
|
31
|
-
return {
|
|
32
|
-
name: name === 'animation' ? 'v-' + name : ':' + name,
|
|
33
|
-
value: parsed.result
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
29
|
],
|
|
@@ -95,16 +86,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
95
86
|
name: 'v-for',
|
|
96
87
|
value: `(${itemName}, ${indexName}) in ${parsed.result}`
|
|
97
88
|
}
|
|
98
|
-
},
|
|
99
|
-
tenon ({ value }, { el }) {
|
|
100
|
-
const parsed = parseMustache(value)
|
|
101
|
-
const attrsMap = el.attrsMap
|
|
102
|
-
const itemName = attrsMap['wx:for-item'] || 'item'
|
|
103
|
-
const indexName = attrsMap['wx:for-index'] || 'index'
|
|
104
|
-
return {
|
|
105
|
-
name: 'v-for',
|
|
106
|
-
value: `(${itemName}, ${indexName}) in ${parsed.result}`
|
|
107
|
-
}
|
|
108
89
|
}
|
|
109
90
|
},
|
|
110
91
|
{
|
|
@@ -130,25 +111,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
130
111
|
name: ':key',
|
|
131
112
|
value
|
|
132
113
|
}
|
|
133
|
-
},
|
|
134
|
-
tenon ({ value }, { el }) {
|
|
135
|
-
// vue的template中不能包含key,对应于小程序中的block
|
|
136
|
-
if (el.tag === 'block') return false
|
|
137
|
-
const itemName = el.attrsMap['wx:for-item'] || 'item'
|
|
138
|
-
const keyName = value
|
|
139
|
-
if (value === '*this') {
|
|
140
|
-
value = itemName
|
|
141
|
-
} else {
|
|
142
|
-
if (isValidIdentifierStr(keyName)) {
|
|
143
|
-
value = `${itemName}.${keyName}`
|
|
144
|
-
} else {
|
|
145
|
-
value = `${itemName}['${keyName}']`
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
name: ':key',
|
|
150
|
-
value
|
|
151
|
-
}
|
|
152
114
|
}
|
|
153
115
|
},
|
|
154
116
|
{
|
|
@@ -159,9 +121,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
159
121
|
},
|
|
160
122
|
web () {
|
|
161
123
|
return false
|
|
162
|
-
},
|
|
163
|
-
tenon () {
|
|
164
|
-
return false
|
|
165
124
|
}
|
|
166
125
|
},
|
|
167
126
|
{
|
|
@@ -204,49 +163,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
204
163
|
}
|
|
205
164
|
]
|
|
206
165
|
}
|
|
207
|
-
},
|
|
208
|
-
tenon ({ value }, { el }) {
|
|
209
|
-
el.hasEvent = true
|
|
210
|
-
const attrsMap = el.attrsMap
|
|
211
|
-
const tagRE = /\{\{((?:.|\n|\r)+?)\}\}(?!})/
|
|
212
|
-
const stringify = JSON.stringify
|
|
213
|
-
const match = tagRE.exec(value)
|
|
214
|
-
if (match) {
|
|
215
|
-
const modelProp = attrsMap['wx:model-prop'] || 'value'
|
|
216
|
-
const modelEvent = attrsMap['wx:model-event'] || 'input'
|
|
217
|
-
const modelValuePathRaw = attrsMap['wx:model-value-path']
|
|
218
|
-
const modelValuePath = modelValuePathRaw === undefined ? 'value' : modelValuePathRaw
|
|
219
|
-
const modelFilter = attrsMap['wx:model-filter']
|
|
220
|
-
let modelValuePathArr
|
|
221
|
-
try {
|
|
222
|
-
modelValuePathArr = JSON5.parse(modelValuePath)
|
|
223
|
-
} catch (e) {
|
|
224
|
-
if (modelValuePath === '') {
|
|
225
|
-
modelValuePathArr = []
|
|
226
|
-
} else {
|
|
227
|
-
modelValuePathArr = modelValuePath.split('.')
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
let modelValue = match[1].trim()
|
|
231
|
-
return [
|
|
232
|
-
{
|
|
233
|
-
name: ':' + modelProp,
|
|
234
|
-
value: modelValue
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
name: 'mpxModelEvent',
|
|
238
|
-
value: modelEvent
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: 'mpxModelEventId',
|
|
242
|
-
value: Math.random().toString(36).substr(3, 8)
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: '@mpxModel',
|
|
246
|
-
value: `__model(${stringifyWithResolveComputed(modelValue)}, $event, ${stringify(modelValuePathArr)}, ${stringify(modelFilter)})`
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
166
|
}
|
|
251
167
|
},
|
|
252
168
|
{
|
|
@@ -265,44 +181,10 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
265
181
|
}
|
|
266
182
|
}
|
|
267
183
|
},
|
|
268
|
-
{
|
|
269
|
-
// style样式绑定
|
|
270
|
-
test: /^(style|wx:style)$/,
|
|
271
|
-
web ({ value }, { el }) {
|
|
272
|
-
if (el.isStyleParsed) {
|
|
273
|
-
return false
|
|
274
|
-
}
|
|
275
|
-
let styleBinding = []
|
|
276
|
-
el.isStyleParsed = true
|
|
277
|
-
el.attrsList.map((item, index) => {
|
|
278
|
-
const parsed = parseMustache(item.value)
|
|
279
|
-
if (item.name === 'style') {
|
|
280
|
-
if (parsed.hasBinding || parsed.result.indexOf('rpx') > -1) {
|
|
281
|
-
styleBinding.push(parseMustache(item.value).result)
|
|
282
|
-
} else {
|
|
283
|
-
styleBinding.push(JSON.stringify(item.value))
|
|
284
|
-
}
|
|
285
|
-
} else if (item.name === 'wx:style') {
|
|
286
|
-
styleBinding.push(parseMustache(item.value).result)
|
|
287
|
-
}
|
|
288
|
-
})
|
|
289
|
-
return {
|
|
290
|
-
name: ':style',
|
|
291
|
-
value: `[${styleBinding}] | transRpxStyle`
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
184
|
{
|
|
296
185
|
// 样式类名绑定
|
|
297
|
-
test: /^wx:(class)$/,
|
|
298
|
-
web ({ value }) {
|
|
299
|
-
const parsed = parseMustache(value)
|
|
300
|
-
return {
|
|
301
|
-
name: ':class',
|
|
302
|
-
value: parsed.result
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
tenon ({ name, value }) {
|
|
186
|
+
test: /^wx:(class|style)$/,
|
|
187
|
+
web ({ name, value }) {
|
|
306
188
|
const dir = this.test.exec(name)[1]
|
|
307
189
|
const parsed = parseMustache(value)
|
|
308
190
|
return {
|
|
@@ -366,17 +248,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
366
248
|
name: 'v-' + dir,
|
|
367
249
|
value: parsed.result
|
|
368
250
|
}
|
|
369
|
-
},
|
|
370
|
-
tenon ({ name, value }) {
|
|
371
|
-
let dir = this.test.exec(name)[1]
|
|
372
|
-
const parsed = parseMustache(value)
|
|
373
|
-
if (dir === 'elif') {
|
|
374
|
-
dir = 'else-if'
|
|
375
|
-
}
|
|
376
|
-
return {
|
|
377
|
-
name: 'v-' + dir,
|
|
378
|
-
value: parsed.result
|
|
379
|
-
}
|
|
380
251
|
}
|
|
381
252
|
},
|
|
382
253
|
// 事件
|
|
@@ -417,23 +288,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
417
288
|
name: rPrefix + rEventName + meta.modifierStr,
|
|
418
289
|
value
|
|
419
290
|
}
|
|
420
|
-
},
|
|
421
|
-
tenon ({ name, value }, { eventRules, el }) {
|
|
422
|
-
const match = this.test.exec(name)
|
|
423
|
-
const prefix = match[1]
|
|
424
|
-
const eventName = match[2]
|
|
425
|
-
const modifierStr = match[3] || ''
|
|
426
|
-
const meta = {
|
|
427
|
-
modifierStr
|
|
428
|
-
}
|
|
429
|
-
// 记录event监听信息用于后续判断是否需要使用内置基础组件
|
|
430
|
-
el.hasEvent = true
|
|
431
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'web', meta })
|
|
432
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'web' })
|
|
433
|
-
return {
|
|
434
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
435
|
-
value
|
|
436
|
-
}
|
|
437
291
|
}
|
|
438
292
|
},
|
|
439
293
|
// 无障碍
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const async = require('async')
|
|
3
|
+
const JSON5 = require('json5')
|
|
4
|
+
const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin')
|
|
5
|
+
const parseRequest = require('./utils/parse-request')
|
|
6
|
+
const toPosix = require('./utils/to-posix')
|
|
7
|
+
const getMainCompilation = require('./utils/get-main-compilation')
|
|
8
|
+
const isUrlRequestRaw = require('./utils/is-url-request')
|
|
9
|
+
const loaderUtils = require('loader-utils')
|
|
10
|
+
const normalize = require('./utils/normalize')
|
|
11
|
+
const addQuery = require('./utils/add-query')
|
|
12
|
+
const nativeLoaderPath = normalize.lib('native-loader')
|
|
13
|
+
|
|
14
|
+
// webpack4中.json文件会走json parser,抽取内容的占位内容必须为合法json,否则会在parse阶段报错
|
|
15
|
+
const defaultResultSource = '{}'
|
|
16
|
+
|
|
17
|
+
// ali不导出的插件页面的固定prefix
|
|
18
|
+
const NO_EXPORT = '__mpx_plugin_no_export_page__'
|
|
19
|
+
|
|
20
|
+
module.exports = function (source) {
|
|
21
|
+
// 该loader中会在每次编译中动态添加entry,不能缓存,否则watch不好使
|
|
22
|
+
this.cacheable(false)
|
|
23
|
+
|
|
24
|
+
const nativeCallback = this.async()
|
|
25
|
+
const mainCompilation = getMainCompilation(this._compilation)
|
|
26
|
+
const mpx = mainCompilation.__mpx__
|
|
27
|
+
|
|
28
|
+
mpx.isPluginMode = true
|
|
29
|
+
|
|
30
|
+
const isUrlRequest = r => isUrlRequestRaw(r, projectRoot)
|
|
31
|
+
const urlToRequest = r => loaderUtils.urlToRequest(r, projectRoot)
|
|
32
|
+
const resolve = (context, request, callback) => {
|
|
33
|
+
const { queryObj } = parseRequest(request)
|
|
34
|
+
context = queryObj.context || context
|
|
35
|
+
return this.resolve(context, request, callback)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const emitWarning = (msg) => {
|
|
39
|
+
this.emitWarning(
|
|
40
|
+
new Error('[plugin loader][' + this.resource + ']: ' + msg)
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const emitError = (msg) => {
|
|
45
|
+
this.emitError(
|
|
46
|
+
new Error('[plugin loader][' + this.resource + ']: ' + msg)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!mpx) {
|
|
51
|
+
return nativeCallback(null, source)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const context = this.context
|
|
55
|
+
const packageName = 'main'
|
|
56
|
+
const pagesMap = mpx.pagesMap
|
|
57
|
+
const getOutputPath = mpx.getOutputPath
|
|
58
|
+
const componentsMap = mpx.componentsMap[packageName]
|
|
59
|
+
const getEntryNode = mpx.getEntryNode
|
|
60
|
+
const resolveMode = mpx.resolveMode
|
|
61
|
+
const projectRoot = mpx.projectRoot
|
|
62
|
+
const extract = mpx.extract
|
|
63
|
+
const pathHash = mpx.pathHash
|
|
64
|
+
const resourceName = this._compilation._preparedEntrypoints[0].name
|
|
65
|
+
|
|
66
|
+
const entryModule = this._module
|
|
67
|
+
// 通过rawRequest关联entryNode和entryModule
|
|
68
|
+
const entryRequest = entryModule.rawRequest
|
|
69
|
+
const entryType = 'Plugin'
|
|
70
|
+
const currentEntry = getEntryNode(entryRequest, entryType, entryModule)
|
|
71
|
+
// 最终输出中不需要为plugin.json产生chunk,而是使用extract直接输出json文件,删除plugin.json对应的entrypoint
|
|
72
|
+
this._compilation._preparedEntrypoints.pop()
|
|
73
|
+
// 为了在体积统计中能够统计到该entry,将其缓存在mpx.removedChunks中
|
|
74
|
+
mpx.removedChunks.push({
|
|
75
|
+
entryModule
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
let entryDeps = new Set()
|
|
79
|
+
|
|
80
|
+
let cacheCallback
|
|
81
|
+
|
|
82
|
+
const checkEntryDeps = (callback) => {
|
|
83
|
+
callback = callback || cacheCallback
|
|
84
|
+
if (callback && entryDeps.size === 0) {
|
|
85
|
+
callback()
|
|
86
|
+
} else {
|
|
87
|
+
cacheCallback = callback
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const addEntrySafely = (resource, name, callback) => {
|
|
92
|
+
const dep = SingleEntryPlugin.createDependency(resource, name)
|
|
93
|
+
entryDeps.add(dep)
|
|
94
|
+
this._compilation.addEntry(this._compiler.context, dep, name, (err, module) => {
|
|
95
|
+
entryDeps.delete(dep)
|
|
96
|
+
checkEntryDeps()
|
|
97
|
+
callback(err, module)
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 初次处理json
|
|
102
|
+
const callback = (err) => {
|
|
103
|
+
checkEntryDeps(() => {
|
|
104
|
+
if (err) return nativeCallback(err)
|
|
105
|
+
if (mpx.mode === 'ali' && pluginEntry.pages) {
|
|
106
|
+
let publicPages = Object.keys(pluginEntry.pages).reduce((cur, key) => {
|
|
107
|
+
if (!key.startsWith(NO_EXPORT)) {
|
|
108
|
+
cur[key] = pluginEntry.pages[key]
|
|
109
|
+
}
|
|
110
|
+
return cur
|
|
111
|
+
}, {})
|
|
112
|
+
pluginEntry.publicPages = publicPages
|
|
113
|
+
pluginEntry.pages = Object.values(pluginEntry.pages)
|
|
114
|
+
}
|
|
115
|
+
const sideEffects = []
|
|
116
|
+
const file = resourceName + '.json'
|
|
117
|
+
sideEffects.push((additionalAssets) => {
|
|
118
|
+
additionalAssets[file].modules = additionalAssets[file].modules || []
|
|
119
|
+
additionalAssets[file].modules.push(entryModule)
|
|
120
|
+
})
|
|
121
|
+
extract(JSON.stringify(pluginEntry), file, 0, sideEffects)
|
|
122
|
+
nativeCallback(null, defaultResultSource)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let pluginEntry
|
|
127
|
+
try {
|
|
128
|
+
pluginEntry = JSON5.parse(source)
|
|
129
|
+
} catch (err) {
|
|
130
|
+
return callback(err)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let processMain, processComponents, processPages
|
|
134
|
+
|
|
135
|
+
processMain = processComponents = processPages = (callback) => {
|
|
136
|
+
callback()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (pluginEntry.main) {
|
|
140
|
+
processMain = function (main, callback) {
|
|
141
|
+
if (!isUrlRequest(main)) return callback()
|
|
142
|
+
if (resolveMode === 'native') {
|
|
143
|
+
main = urlToRequest(main)
|
|
144
|
+
}
|
|
145
|
+
resolve(context, main, (err, resource) => {
|
|
146
|
+
if (err) return callback(err)
|
|
147
|
+
const { resourcePath } = parseRequest(resource)
|
|
148
|
+
// 获取pageName
|
|
149
|
+
const relative = path.relative(context, resourcePath)
|
|
150
|
+
const mainPath = toPosix(/^(.*?)(\.[^.]*)?$/.exec(relative)[1])
|
|
151
|
+
if (/^\./.test(mainPath)) {
|
|
152
|
+
emitError(`The plugin's main path [${main}] must be in the context [${context}]!`)
|
|
153
|
+
return callback()
|
|
154
|
+
}
|
|
155
|
+
pluginEntry.main = mainPath + '.js'
|
|
156
|
+
addEntrySafely(resource, mainPath, (err, module) => {
|
|
157
|
+
if (err) return callback(err)
|
|
158
|
+
mpx.pluginMainModule = module
|
|
159
|
+
currentEntry.addChild(getEntryNode(resource, 'PluginMain', module))
|
|
160
|
+
callback(err, module)
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
}.bind(this, pluginEntry.main)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (pluginEntry.publicComponents) {
|
|
167
|
+
processComponents = function (components, callback) {
|
|
168
|
+
async.forEachOf(components, (component, name, callback) => {
|
|
169
|
+
if (!isUrlRequest(component)) return callback()
|
|
170
|
+
if (resolveMode === 'native') {
|
|
171
|
+
component = urlToRequest(component)
|
|
172
|
+
}
|
|
173
|
+
resolve(context, component, (err, resource, info) => {
|
|
174
|
+
if (err) return callback(err)
|
|
175
|
+
const resourcePath = parseRequest(resource).resourcePath
|
|
176
|
+
const parsed = path.parse(resourcePath)
|
|
177
|
+
const ext = parsed.ext
|
|
178
|
+
let outputPath
|
|
179
|
+
if (ext === '.js') {
|
|
180
|
+
let root = info.descriptionFileRoot
|
|
181
|
+
let name = 'nativeComponent'
|
|
182
|
+
if (info.descriptionFileData) {
|
|
183
|
+
if (info.descriptionFileData.miniprogram) {
|
|
184
|
+
root = path.join(root, info.descriptionFileData.miniprogram)
|
|
185
|
+
}
|
|
186
|
+
if (info.descriptionFileData.name) {
|
|
187
|
+
// 去掉name里面的@符号,因为支付宝不支持文件路径上有@
|
|
188
|
+
name = info.descriptionFileData.name.split('@').join('')
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const resourceName = path.join(parsed.dir, parsed.name)
|
|
192
|
+
let relativePath = path.relative(root, resourceName)
|
|
193
|
+
outputPath = path.join('components', name + pathHash(root), relativePath)
|
|
194
|
+
} else {
|
|
195
|
+
outputPath = getOutputPath(resourcePath, 'component')
|
|
196
|
+
}
|
|
197
|
+
const componentPath = toPosix(outputPath)
|
|
198
|
+
pluginEntry.publicComponents[name] = componentPath
|
|
199
|
+
// 与json-compiler处理组件的行为表现一致
|
|
200
|
+
resource = addQuery(resource, {
|
|
201
|
+
packageName: 'main'
|
|
202
|
+
})
|
|
203
|
+
if (ext === '.js') {
|
|
204
|
+
resource = '!!' + nativeLoaderPath + '!' + resource
|
|
205
|
+
}
|
|
206
|
+
currentEntry.addChild(getEntryNode(resource, 'Component'))
|
|
207
|
+
// 如果之前已经创建了入口,直接return
|
|
208
|
+
if (componentsMap[resourcePath] === componentPath) return callback()
|
|
209
|
+
componentsMap[resourcePath] = componentPath
|
|
210
|
+
addEntrySafely(resource, componentPath, callback)
|
|
211
|
+
})
|
|
212
|
+
}, callback)
|
|
213
|
+
}.bind(this, pluginEntry.publicComponents)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (pluginEntry.pages) {
|
|
217
|
+
// 处理 pages
|
|
218
|
+
if (mpx.srcMode === 'ali') { // 处理ali
|
|
219
|
+
let pagesMap = pluginEntry.publicPages
|
|
220
|
+
pluginEntry.pages = pluginEntry.pages.reduce((cur, val, index) => {
|
|
221
|
+
if (!Object.values(pagesMap).includes(val)) { // no export page
|
|
222
|
+
cur[`${NO_EXPORT}${index}`] = val
|
|
223
|
+
}
|
|
224
|
+
return cur
|
|
225
|
+
}, pagesMap)
|
|
226
|
+
}
|
|
227
|
+
processPages = function (pages, callback) {
|
|
228
|
+
async.forEachOf(pages, (page, name, callback) => {
|
|
229
|
+
let aliasPath = ''
|
|
230
|
+
if (typeof page !== 'string') {
|
|
231
|
+
aliasPath = page.path
|
|
232
|
+
page = page.src
|
|
233
|
+
}
|
|
234
|
+
if (!isUrlRequest(page)) return callback()
|
|
235
|
+
if (resolveMode === 'native') {
|
|
236
|
+
page = urlToRequest(page)
|
|
237
|
+
}
|
|
238
|
+
resolve(context, page, (err, resource) => {
|
|
239
|
+
if (err) return callback(err)
|
|
240
|
+
const { resourcePath } = parseRequest(resource)
|
|
241
|
+
const ext = path.extname(resourcePath)
|
|
242
|
+
// 获取pageName
|
|
243
|
+
let pageName
|
|
244
|
+
if (aliasPath) {
|
|
245
|
+
pageName = toPosix(aliasPath)
|
|
246
|
+
// 判断 key 存在重复情况直接报错
|
|
247
|
+
for (let key in pagesMap) {
|
|
248
|
+
if (pagesMap[key] === pageName && key !== resourcePath) {
|
|
249
|
+
emitError(`Current page [${resourcePath}] registers a conflict page path [${pageName}] with existed page [${key}], which is not allowed, please rename it!`)
|
|
250
|
+
return callback()
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
const relative = path.relative(context, resourcePath)
|
|
255
|
+
pageName = toPosix(/^(.*?)(\.[^.]*)?$/.exec(relative)[1])
|
|
256
|
+
if (/^\./.test(pageName)) {
|
|
257
|
+
// 如果当前page不存在于context中,插件模式下报错
|
|
258
|
+
emitError(`Current page [${resourcePath}] is not in current pages directory [${context}], which is not allowed in plugin mode!`)
|
|
259
|
+
return callback()
|
|
260
|
+
}
|
|
261
|
+
// 如果当前page与已有page存在命名冲突,插件模式下报错
|
|
262
|
+
for (let key in pagesMap) {
|
|
263
|
+
if (pagesMap[key] === pageName && key !== resourcePath) {
|
|
264
|
+
emitError(`Current page [${resourcePath}] is registered with a conflict page path [${pageName}], which is already existed in system, which is not allowed in plugin mode!`)
|
|
265
|
+
return callback()
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (ext === '.js') {
|
|
270
|
+
resource = '!!' + nativeLoaderPath + '!' + resource
|
|
271
|
+
}
|
|
272
|
+
// 如果之前已经创建了入口,直接return
|
|
273
|
+
if (pagesMap[resourcePath]) {
|
|
274
|
+
emitWarning(`Current page [${resourcePath}] which is imported from [${this.resourcePath}] has been registered in pagesMap already, it will be ignored, please check it and remove the redundant page declaration!`)
|
|
275
|
+
return callback()
|
|
276
|
+
}
|
|
277
|
+
currentEntry.addChild(getEntryNode(resource, 'Page'))
|
|
278
|
+
pagesMap[resourcePath] = pageName
|
|
279
|
+
pluginEntry.pages[name] = pageName
|
|
280
|
+
addEntrySafely(resource, pageName, callback)
|
|
281
|
+
})
|
|
282
|
+
}, callback)
|
|
283
|
+
}.bind(this, pluginEntry.pages)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async.parallel([processMain, processComponents, processPages], callback)
|
|
287
|
+
}
|
|
@@ -2,8 +2,7 @@ const path = require('path')
|
|
|
2
2
|
const stringifyQuery = require('../utils/stringify-query')
|
|
3
3
|
const parseQuery = require('loader-utils').parseQuery
|
|
4
4
|
const addInfix = require('../utils/add-infix')
|
|
5
|
-
const
|
|
6
|
-
const { JSON_JS_EXT } = require('../utils/const')
|
|
5
|
+
const matchCondition = require('../utils/match-condition')
|
|
7
6
|
|
|
8
7
|
module.exports = class AddEnvPlugin {
|
|
9
8
|
constructor (source, env, fileConditionRules, target) {
|
|
@@ -25,8 +24,8 @@ module.exports = class AddEnvPlugin {
|
|
|
25
24
|
}
|
|
26
25
|
const resourcePath = request.path
|
|
27
26
|
let extname = ''
|
|
28
|
-
if (resourcePath.endsWith(
|
|
29
|
-
extname =
|
|
27
|
+
if (resourcePath.endsWith('.json.js')) {
|
|
28
|
+
extname = '.json.js'
|
|
30
29
|
} else {
|
|
31
30
|
extname = path.extname(resourcePath)
|
|
32
31
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const stringifyQuery = require('../utils/stringify-query')
|
|
3
3
|
const parseQuery = require('loader-utils').parseQuery
|
|
4
|
-
const
|
|
4
|
+
const matchCondition = require('../utils/match-condition')
|
|
5
5
|
const addInfix = require('../utils/add-infix')
|
|
6
|
-
const { JSON_JS_EXT } = require('../utils/const')
|
|
7
6
|
|
|
8
7
|
module.exports = class AddModePlugin {
|
|
9
8
|
constructor (source, mode, fileConditionRules, target) {
|
|
@@ -25,8 +24,8 @@ module.exports = class AddModePlugin {
|
|
|
25
24
|
}
|
|
26
25
|
const resourcePath = request.path
|
|
27
26
|
let extname = ''
|
|
28
|
-
if (resourcePath.endsWith(
|
|
29
|
-
extname =
|
|
27
|
+
if (resourcePath.endsWith('.json.js')) {
|
|
28
|
+
extname = '.json.js'
|
|
30
29
|
} else {
|
|
31
30
|
extname = path.extname(resourcePath)
|
|
32
31
|
}
|
|
@@ -1,42 +1,55 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @desc 获取小程序npm包资源入口目录
|
|
4
|
+
*/
|
|
5
|
+
const getEntry = (name, miniprogram) => {
|
|
6
|
+
return path.join(name, miniprogram)
|
|
7
|
+
}
|
|
3
8
|
|
|
4
9
|
module.exports = class PackageEntryPlugin {
|
|
5
|
-
constructor (source,
|
|
10
|
+
constructor (source, miniNpmPackage, target) {
|
|
6
11
|
this.source = source
|
|
7
12
|
this.target = target
|
|
8
|
-
this.
|
|
13
|
+
this.miniNpmPackage = miniNpmPackage
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* 判断是否需要更改innerRequest
|
|
13
18
|
* 小程序发布npm包约束: package.json配置miniprogram 或默认 miniprogram_dist目录
|
|
19
|
+
* 0. 前提: request中含有package.json中name字段
|
|
14
20
|
* 1. package.json中配置了miniprogram, 且request中不含miniprogram,尝试拼接
|
|
15
|
-
* 2. 用户配置
|
|
21
|
+
* 2. 用户配置miniNpmPackage说明是小程序npm包,如果package.json中没配置miniprogram字段,则尝试拼接默认miniprogram_dist目录
|
|
16
22
|
*/
|
|
17
23
|
apply (resolver) {
|
|
18
24
|
const target = resolver.ensureHook(this.target)
|
|
19
|
-
resolver.getHook(this.source).tapAsync('
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (request.miniprogram || !descriptionFileData) return callback()
|
|
23
|
-
|
|
24
|
-
let { name, miniprogram } = descriptionFileData
|
|
25
|
-
if (!miniprogram && this.miniNpmPackages.includes(name)) miniprogram = 'miniprogram_dist'
|
|
26
|
-
if (!miniprogram) return callback()
|
|
27
|
-
|
|
28
|
-
let relativePath = path.relative(descriptionFileRoot, resourcePath)
|
|
29
|
-
if (relativePath.startsWith(miniprogram)) return callback()
|
|
30
|
-
|
|
31
|
-
relativePath = path.join(miniprogram, relativePath)
|
|
25
|
+
resolver.getHook(this.source).tapAsync('PackagePlugin', (request, resolveContext, callback) => {
|
|
26
|
+
const innerRequest = request.request || request.path
|
|
27
|
+
if (!innerRequest || request.miniprogram) return callback()
|
|
32
28
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
const descriptionFileData = request.descriptionFileData || {}
|
|
30
|
+
const { name = '', miniprogram } = descriptionFileData
|
|
31
|
+
let newEntry = ''
|
|
32
|
+
// request.path和系统环境有关:windows和linux
|
|
33
|
+
let normalizedName = path.normalize(name)
|
|
34
|
+
if (innerRequest.indexOf(normalizedName) === -1) {
|
|
35
|
+
return callback()
|
|
36
|
+
}
|
|
37
|
+
if (miniprogram) {
|
|
38
|
+
newEntry = getEntry(normalizedName, miniprogram)
|
|
39
|
+
} else if (this.miniNpmPackage.includes(name)) {
|
|
40
|
+
newEntry = getEntry(normalizedName, 'miniprogram_dist')
|
|
41
|
+
}
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
if (newEntry) {
|
|
44
|
+
const newRequest = innerRequest.replace(normalizedName, newEntry)
|
|
45
|
+
const obj = Object.assign({}, request, {
|
|
46
|
+
request: newRequest,
|
|
47
|
+
miniprogram: true
|
|
48
|
+
})
|
|
49
|
+
resolver.doResolve(target, obj, `change request ${innerRequest} to :` + newRequest, resolveContext, callback)
|
|
50
|
+
} else {
|
|
51
|
+
callback()
|
|
52
|
+
}
|
|
40
53
|
})
|
|
41
54
|
}
|
|
42
55
|
}
|
package/lib/runtime/base.styl
CHANGED
|
@@ -120,8 +120,3 @@ html, body, .app {
|
|
|
120
120
|
font-family "weui"
|
|
121
121
|
src url('data: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AAAAAAUACwATAAEAAAAAAAYABAAeAAEAAAAAAAoAKwAiAAEAAAAAAAsAEwBNAAMAAQQJAAEACABgAAMAAQQJAAIADgBoAAMAAQQJAAMACAB2AAMAAQQJAAQACAB+AAMAAQQJAAUAFgCGAAMAAQQJAAYACACcAAMAAQQJAAoAVgCkAAMAAQQJAAsAJgD6d2V1aVJlZ3VsYXJ3ZXVpd2V1aVZlcnNpb24gMS4wd2V1aUdlbmVyYXRlZCBieSBzdmcydHRmIGZyb20gRm9udGVsbG8gcHJvamVjdC5odHRwOi8vZm9udGVsbG8uY29tAHcAZQB1AGkAUgBlAGcAdQBsAGEAcgB3AGUAdQBpAHcAZQB1AGkAVgBlAHIAcwBpAG8AbgAgADEALgAwAHcAZQB1AGkARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAQIBAwEEAQUBBgEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETAAZjaXJjbGUIZG93bmxvYWQEaW5mbwxzYWZlX3N1Y2Nlc3MJc2FmZV93YXJuB3N1Y2Nlc3MOc3VjY2Vzcy1jaXJjbGURc3VjY2Vzcy1uby1jaXJjbGUHd2FpdGluZw53YWl0aW5nLWNpcmNsZQR3YXJuC2luZm8tY2lyY2xlBmNhbmNlbAZzZWFyY2gFY2xlYXIEYmFjawZkZWxldGUAAAAA') format('truetype')
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
.mpx-root-view {
|
|
125
|
-
display: inline
|
|
126
|
-
line-height: normal
|
|
127
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isEmptyObject } from './util'
|
|
2
|
-
|
|
2
|
+
import { inBrowser } from '../../../utils/env'
|
|
3
|
+
|
|
4
|
+
const isTouchDevice = inBrowser && ('ontouchstart' in document.documentElement)
|
|
3
5
|
|
|
4
6
|
function processModel (listeners, context) {
|
|
5
7
|
// 该函数只有wx:model的情况下才调用,而且默认e.detail.value有值
|