@mpxjs/webpack-plugin 2.6.114-alpha.4 → 2.6.114-alpha.7

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.
Files changed (104) hide show
  1. package/lib/{dependency → dependencies}/AddEntryDependency.js +0 -0
  2. package/lib/dependencies/AppEntryDependency.js +58 -0
  3. package/lib/dependencies/CommonJsAsyncDependency.js +51 -0
  4. package/lib/dependencies/CommonJsVariableDependency.js +81 -0
  5. package/lib/dependencies/DynamicEntryDependency.js +171 -0
  6. package/lib/dependencies/FlagPluginDependency.js +24 -0
  7. package/lib/dependencies/InjectDependency.js +43 -0
  8. package/lib/dependencies/RecordGlobalComponentsDependency.js +50 -0
  9. package/lib/dependencies/RecordIndependentDependency.js +44 -0
  10. package/lib/dependencies/RecordResourceMapDependency.js +62 -0
  11. package/lib/dependencies/RemoveEntryDependency.js +40 -0
  12. package/lib/{dependency → dependencies}/ReplaceDependency.js +19 -2
  13. package/lib/dependencies/ResolveDependency.js +88 -0
  14. package/lib/extractor.js +82 -178
  15. package/lib/file-loader.js +7 -19
  16. package/lib/helpers.js +39 -334
  17. package/lib/independent-loader.js +52 -0
  18. package/lib/index.js +864 -541
  19. package/lib/json-compiler/helper.js +156 -0
  20. package/lib/json-compiler/index.js +242 -451
  21. package/lib/json-compiler/plugin.js +150 -0
  22. package/lib/json-compiler/{theme-loader.js → theme.js} +5 -3
  23. package/lib/loader.js +137 -240
  24. package/lib/native-loader.js +71 -133
  25. package/lib/parser.js +1 -2
  26. package/lib/partial-compile/index.js +35 -0
  27. package/lib/platform/json/wx/index.js +1 -1
  28. package/lib/platform/template/normalize-component-rules.js +2 -3
  29. package/lib/platform/template/wx/index.js +30 -4
  30. package/lib/record-loader.js +11 -0
  31. package/lib/{path-loader.js → resolve-loader.js} +0 -0
  32. package/lib/resolver/AddEnvPlugin.js +4 -3
  33. package/lib/resolver/AddModePlugin.js +4 -3
  34. package/lib/resolver/FixDescriptionInfoPlugin.js +28 -0
  35. package/lib/resolver/PackageEntryPlugin.js +23 -36
  36. package/lib/runtime/base.styl +5 -0
  37. package/lib/runtime/components/tenon/tenon-button.vue +1 -1
  38. package/lib/runtime/components/tenon/tenon-image.vue +1 -1
  39. package/lib/runtime/components/tenon/tenon-input.vue +1 -1
  40. package/lib/runtime/components/tenon/tenon-switch.vue +1 -1
  41. package/lib/runtime/components/tenon/tenon-text-area.vue +1 -1
  42. package/lib/runtime/components/tenon/tenon-text.vue +1 -1
  43. package/lib/runtime/components/web/mpx-image.vue +20 -5
  44. package/lib/runtime/components/web/mpx-movable-view.vue +6 -2
  45. package/lib/runtime/components/web/mpx-swiper.vue +18 -3
  46. package/lib/runtime/i18n.wxs +31 -11
  47. package/lib/runtime/optionProcessor.js +48 -3
  48. package/lib/selector.js +29 -10
  49. package/lib/style-compiler/index.js +15 -23
  50. package/lib/style-compiler/load-postcss-config.js +3 -1
  51. package/lib/style-compiler/plugins/conditional-strip.js +68 -65
  52. package/lib/style-compiler/plugins/rpx.js +43 -37
  53. package/lib/style-compiler/plugins/scope-id.js +79 -72
  54. package/lib/style-compiler/plugins/trans-special.js +25 -18
  55. package/lib/style-compiler/plugins/trim.js +13 -7
  56. package/lib/style-compiler/plugins/vw.js +22 -16
  57. package/lib/template-compiler/compiler.js +95 -197
  58. package/lib/template-compiler/index.js +52 -139
  59. package/lib/template-compiler/trans-dynamic-class-expr.js +18 -13
  60. package/lib/tenon/index.js +1 -3
  61. package/lib/tenon/processScript.js +52 -40
  62. package/lib/url-loader.js +11 -29
  63. package/lib/utils/add-query.js +1 -1
  64. package/lib/utils/const.js +10 -0
  65. package/lib/utils/emit-file.js +10 -0
  66. package/lib/utils/eval-json-js.js +31 -0
  67. package/lib/utils/get-entry-name.js +13 -0
  68. package/lib/utils/get-json-content.js +42 -0
  69. package/lib/utils/is-url-request.js +10 -1
  70. package/lib/utils/match-condition.js +4 -1
  71. package/lib/utils/normalize.js +4 -15
  72. package/lib/utils/parse-request.js +3 -3
  73. package/lib/utils/resolve.js +13 -0
  74. package/lib/utils/set.js +47 -0
  75. package/lib/utils/stringify-loaders-resource.js +25 -0
  76. package/lib/utils/stringify-query.js +4 -0
  77. package/lib/web/processJSON.js +113 -144
  78. package/lib/web/processScript.js +47 -34
  79. package/lib/web/processTemplate.js +57 -40
  80. package/lib/wxml/{wxml-loader.js → loader.js} +21 -62
  81. package/lib/wxs/WxsModuleIdsPlugin.js +29 -0
  82. package/lib/wxs/WxsParserPlugin.js +2 -2
  83. package/lib/wxs/WxsPlugin.js +4 -8
  84. package/lib/wxs/WxsTemplatePlugin.js +46 -92
  85. package/lib/wxs/{wxs-i18n-loader.js → i18n-loader.js} +5 -4
  86. package/lib/wxs/loader.js +142 -0
  87. package/lib/wxs/{wxs-pre-loader.js → pre-loader.js} +20 -5
  88. package/lib/wxss/loader.js +31 -43
  89. package/lib/wxss/localsLoader.js +1 -5
  90. package/lib/wxss/processCss.js +107 -103
  91. package/package.json +18 -20
  92. package/lib/built-in-loader.js +0 -49
  93. package/lib/content-loader.js +0 -13
  94. package/lib/dependency/ChildCompileDependency.js +0 -24
  95. package/lib/dependency/InjectDependency.js +0 -26
  96. package/lib/dependency/RemovedModuleDependency.js +0 -23
  97. package/lib/dependency/ResolveDependency.js +0 -53
  98. package/lib/plugin-loader.js +0 -287
  99. package/lib/staticConfig.js +0 -4
  100. package/lib/utils/get-main-compilation.js +0 -6
  101. package/lib/utils/read-json-for-src.js +0 -34
  102. package/lib/utils/try-require.js +0 -16
  103. package/lib/wxs/wxs-loader.js +0 -117
  104. package/lib/wxss/getImportPrefix.js +0 -30
@@ -17,129 +17,133 @@ const modulesScope = require('postcss-modules-scope')
17
17
  const modulesValues = require('postcss-modules-values')
18
18
  const valueParser = require('postcss-value-parser')
19
19
  const isUrlRequest = require('../utils/is-url-request')
20
+ // css-loader-parser
20
21
 
21
- const parserPlugin = postcss.plugin('css-loader-parser', function (options) {
22
- return function (css) {
23
- const imports = {}
24
- let exports = {}
25
- const importItems = []
26
- const urlItems = []
22
+ const parserPlugin = function (options) {
23
+ return {
24
+ postcssPlugin: 'css-loader-parser',
25
+ Once (css) {
26
+ const imports = {}
27
+ let exports = {}
28
+ const importItems = []
29
+ const urlItems = []
30
+
31
+ function replaceImportsInString (str) {
32
+ if (options.import) {
33
+ const tokens = valueParser(str)
34
+ tokens.walk(function (node) {
35
+ if (node.type !== 'word') {
36
+ return
37
+ }
38
+ const token = node.value
39
+ const importIndex = imports['$' + token]
40
+ if (typeof importIndex === 'number') {
41
+ node.value = '___CSS_LOADER_IMPORT___' + importIndex + '___'
42
+ }
43
+ })
44
+ return tokens.toString()
45
+ }
46
+ return str
47
+ }
27
48
 
28
- function replaceImportsInString (str) {
29
49
  if (options.import) {
30
- const tokens = valueParser(str)
31
- tokens.walk(function (node) {
32
- if (node.type !== 'word') {
50
+ css.walkAtRules(/^import$/i, function (rule) {
51
+ const values = Tokenizer.parseValues(rule.params)
52
+ let url = values.nodes[0].nodes[0]
53
+ if (url && url.type === 'url') {
54
+ url = url.url
55
+ } else if (url && url.type === 'string') {
56
+ url = url.value
57
+ } else throw rule.error('Unexpected format ' + rule.params)
58
+ if (!url.replace(/\s/g, '').length) {
33
59
  return
34
60
  }
35
- const token = node.value
36
- const importIndex = imports['$' + token]
37
- if (typeof importIndex === 'number') {
38
- node.value = '___CSS_LOADER_IMPORT___' + importIndex + '___'
61
+ values.nodes[0].nodes.shift()
62
+ const mediaQuery = Tokenizer.stringifyValues(values)
63
+
64
+ if (isUrlRequest(url, options.root)) {
65
+ url = loaderUtils.urlToRequest(url, options.root)
39
66
  }
67
+
68
+ importItems.push({
69
+ url: url,
70
+ mediaQuery: mediaQuery
71
+ })
72
+ rule.remove()
40
73
  })
41
- return tokens.toString()
42
74
  }
43
- return str
44
- }
45
-
46
- if (options.import) {
47
- css.walkAtRules(/^import$/i, function (rule) {
48
- const values = Tokenizer.parseValues(rule.params)
49
- let url = values.nodes[0].nodes[0]
50
- if (url && url.type === 'url') {
51
- url = url.url
52
- } else if (url && url.type === 'string') {
53
- url = url.value
54
- } else throw rule.error('Unexpected format ' + rule.params)
55
- if (!url.replace(/\s/g, '').length) {
56
- return
57
- }
58
- values.nodes[0].nodes.shift()
59
- const mediaQuery = Tokenizer.stringifyValues(values)
60
75
 
61
- if (isUrlRequest(url, options.root)) {
62
- url = loaderUtils.urlToRequest(url, options.root)
63
- }
64
-
65
- importItems.push({
66
- url: url,
67
- mediaQuery: mediaQuery
76
+ const icss = icssUtils.extractICSS(css)
77
+ exports = icss.icssExports
78
+ Object.keys(icss.icssImports).forEach(function (key) {
79
+ const url = loaderUtils.parseString(key)
80
+ Object.keys(icss.icssImports[key]).forEach(function (prop) {
81
+ imports['$' + prop] = importItems.length
82
+ importItems.push({
83
+ url: url,
84
+ export: icss.icssImports[key][prop]
85
+ })
68
86
  })
69
- rule.remove()
70
87
  })
71
- }
72
88
 
73
- const icss = icssUtils.extractICSS(css)
74
- exports = icss.icssExports
75
- Object.keys(icss.icssImports).forEach(function (key) {
76
- const url = loaderUtils.parseString(key)
77
- Object.keys(icss.icssImports[key]).forEach(function (prop) {
78
- imports['$' + prop] = importItems.length
79
- importItems.push({
80
- url: url,
81
- export: icss.icssImports[key][prop]
82
- })
89
+ Object.keys(exports).forEach(function (exportName) {
90
+ exports[exportName] = replaceImportsInString(exports[exportName])
83
91
  })
84
- })
85
-
86
- Object.keys(exports).forEach(function (exportName) {
87
- exports[exportName] = replaceImportsInString(exports[exportName])
88
- })
89
92
 
90
- function isAlias (url) {
91
- // Handle alias starting by / and root disabled
92
- return url !== options.resolve(url)
93
- }
93
+ function isAlias (url) {
94
+ // Handle alias starting by / and root disabled
95
+ return url !== options.resolve(url)
96
+ }
94
97
 
95
- function processNode (item) {
96
- switch (item.type) {
97
- case 'value':
98
- item.nodes.forEach(processNode)
99
- break
100
- case 'nested-item':
101
- item.nodes.forEach(processNode)
102
- break
103
- case 'item':
104
- const importIndex = imports['$' + item.name]
105
- if (typeof importIndex === 'number') {
106
- item.name = '___CSS_LOADER_IMPORT___' + importIndex + '___'
107
- }
108
- break
109
- case 'url':
110
- if (options.url && item.url.replace(/\s/g, '').length && !/^#/.test(item.url) && (isAlias(item.url) || isUrlRequest(item.url, options.root))) {
111
- // Strip quotes, they will be re-added if the module needs them
112
- item.stringType = ''
113
- delete item.innerSpacingBefore
114
- delete item.innerSpacingAfter
115
- const url = item.url
116
- item.url = '___CSS_LOADER_URL___' + urlItems.length + '___'
117
- urlItems.push({
118
- url: url
119
- })
120
- }
121
- break
98
+ function processNode (item) {
99
+ switch (item.type) {
100
+ case 'value':
101
+ item.nodes.forEach(processNode)
102
+ break
103
+ case 'nested-item':
104
+ item.nodes.forEach(processNode)
105
+ break
106
+ case 'item':
107
+ const importIndex = imports['$' + item.name]
108
+ if (typeof importIndex === 'number') {
109
+ item.name = '___CSS_LOADER_IMPORT___' + importIndex + '___'
110
+ }
111
+ break
112
+ case 'url':
113
+ if (options.url && item.url.replace(/\s/g, '').length && !/^#/.test(item.url) && (isAlias(item.url) || isUrlRequest(item.url, options.root))) {
114
+ // Strip quotes, they will be re-added if the module needs them
115
+ item.stringType = ''
116
+ delete item.innerSpacingBefore
117
+ delete item.innerSpacingAfter
118
+ const url = item.url
119
+ item.url = '___CSS_LOADER_URL___' + urlItems.length + '___'
120
+ urlItems.push({
121
+ url: url
122
+ })
123
+ }
124
+ break
125
+ }
122
126
  }
123
- }
124
127
 
125
- css.walkDecls(function (decl) {
126
- const values = Tokenizer.parseValues(decl.value)
127
- values.nodes.forEach(function (value) {
128
- value.nodes.forEach(processNode)
128
+ css.walkDecls(function (decl) {
129
+ const values = Tokenizer.parseValues(decl.value)
130
+ values.nodes.forEach(function (value) {
131
+ value.nodes.forEach(processNode)
132
+ })
133
+ decl.value = Tokenizer.stringifyValues(values)
134
+ })
135
+ css.walkAtRules(function (atrule) {
136
+ if (typeof atrule.params === 'string') {
137
+ atrule.params = replaceImportsInString(atrule.params)
138
+ }
129
139
  })
130
- decl.value = Tokenizer.stringifyValues(values)
131
- })
132
- css.walkAtRules(function (atrule) {
133
- if (typeof atrule.params === 'string') {
134
- atrule.params = replaceImportsInString(atrule.params)
135
- }
136
- })
137
140
 
138
- options.importItems = importItems
139
- options.urlItems = urlItems
140
- options.exports = exports
141
+ options.importItems = importItems
142
+ options.urlItems = urlItems
143
+ options.exports = exports
144
+ }
141
145
  }
142
- })
146
+ }
143
147
 
144
148
  module.exports = function processCss (inputSource, inputMap, options, callback) {
145
149
  const query = options.query
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.6.114-alpha.4",
3
+ "version": "2.6.114-alpha.7",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -35,7 +35,7 @@
35
35
  "consolidate": "^0.15.1",
36
36
  "css": "^2.2.1",
37
37
  "css-selector-tokenizer": "^0.7.0",
38
- "cssnano": "^3.10.0",
38
+ "cssnano": "^5.0.16",
39
39
  "de-indent": "^1.0.2",
40
40
  "fastparse": "^1.1.1",
41
41
  "hash-sum": "^1.0.2",
@@ -43,28 +43,24 @@
43
43
  "html-minifier": "^3.5.8",
44
44
  "icss-utils": "^2.1.0",
45
45
  "json5": "^2.1.3",
46
- "loader-utils": "1.1.0",
46
+ "loader-utils": "^2.0.2",
47
47
  "lodash": "^4.17.15",
48
48
  "lodash.camelcase": "^4.3.0",
49
49
  "lru-cache": "^4.1.2",
50
50
  "mime": "^2.2.2",
51
51
  "object-assign": "^4.1.1",
52
- "postcss": "^6.0.19",
53
- "postcss-load-config": "^1.2.0",
54
- "postcss-modules-extract-imports": "^1.2.0",
55
- "postcss-modules-local-by-default": "^1.2.0",
56
- "postcss-modules-scope": "^1.1.0",
57
- "postcss-modules-values": "^1.3.0",
58
- "postcss-selector-parser": "^2.0.0",
59
- "postcss-value-parser": "^3.3.0",
60
- "resolve": "^1.5.0",
61
- "source-list-map": "^2.0.0",
62
- "webpack-sources": "^1.1.0"
52
+ "postcss": "^8.4.5",
53
+ "postcss-load-config": "^3.1.1",
54
+ "postcss-modules-extract-imports": "^3.0.0",
55
+ "postcss-modules-local-by-default": "^4.0.0",
56
+ "postcss-modules-scope": "^3.0.0",
57
+ "postcss-modules-values": "^4.0.0",
58
+ "postcss-selector-parser": "^6.0.8",
59
+ "postcss-value-parser": "^4.0.2",
60
+ "source-list-map": "^2.0.0"
63
61
  },
64
62
  "peerDependencies": {
65
- "css-loader": "^0.28.10",
66
- "webpack": "^4.0.0",
67
- "webpack-cli": "^3.0.0"
63
+ "webpack": "^5.48.0"
68
64
  },
69
65
  "publishConfig": {
70
66
  "registry": "https://registry.npmjs.org"
@@ -82,8 +78,10 @@
82
78
  },
83
79
  "devDependencies": {
84
80
  "@types/babel-traverse": "^6.25.4",
85
- "@types/babel-types": "^7.0.4",
86
- "webpack": "^4.46.0"
81
+ "@types/babel-types": "^7.0.4"
87
82
  },
88
- "gitHead": "9e21edc9a7478dc477064bd14679f794d892592b"
83
+ "engines": {
84
+ "node": ">=14.14.0"
85
+ },
86
+ "gitHead": "7845b794ae3b68530449aedac841b5910ef7a546"
89
87
  }
@@ -1,49 +0,0 @@
1
- const parseComponent = require('./parser')
2
- const loaderUtils = require('loader-utils')
3
- const parseRequest = require('./utils/parse-request')
4
- const normalize = require('./utils/normalize')
5
- const selectorPath = normalize.lib('selector')
6
- const genComponentTag = require('./utils/gen-component-tag')
7
- const getMainCompilation = require('./utils/get-main-compilation')
8
-
9
- module.exports = function (content) {
10
- this.cacheable()
11
- const mainCompilation = getMainCompilation(this._compilation)
12
- const mpx = mainCompilation.__mpx__
13
- if (!mpx) {
14
- return content
15
- }
16
- const mode = mpx.mode
17
- const env = mpx.env
18
- const defs = mpx.defs
19
- const resourcePath = parseRequest(this.resource).resourcePath
20
- const parts = parseComponent(content, {
21
- filePath: resourcePath,
22
- needMap: this.sourceMap,
23
- mode,
24
- defs,
25
- env
26
- })
27
-
28
- let output = ''
29
-
30
- // 内建组件编写规范比较统一,不需要处理太多情况
31
- if (parts.template) {
32
- output += genComponentTag(parts.template)
33
- }
34
-
35
- if (parts.script) {
36
- output += '\n' + genComponentTag(parts.script, (script) => {
37
- let content = ''
38
- if (parts.styles && parts.styles.length) {
39
- parts.styles.forEach((style, i) => {
40
- const requestString = loaderUtils.stringifyRequest(this, `builtInComponent.styl!=!${selectorPath}?type=styles&index=${i}!${loaderUtils.getRemainingRequest(this)}`)
41
- content += `\n import ${requestString}`
42
- })
43
- }
44
- content += script.content
45
- return content
46
- })
47
- }
48
- return output
49
- }
@@ -1,13 +0,0 @@
1
- module.exports = function (content) {
2
- if (!this.__mpx__) {
3
- return content
4
- }
5
- // todo 由于additionalAssets阶段还会进行一次依赖同步,此处获取的依赖不一定是最终的依赖,可能会有bad case
6
- this.__mpx__.fileDependencies.forEach(file => {
7
- this.addDependency(file)
8
- })
9
- this.__mpx__.contextDependencies.forEach(context => {
10
- this.addContextDependency(context)
11
- })
12
- return this.__mpx__.content
13
- }
@@ -1,24 +0,0 @@
1
- const NullDependency = require('webpack/lib/dependencies/NullDependency')
2
-
3
- class ChildCompileDependency extends NullDependency {
4
- constructor (module) {
5
- super()
6
- this.childCompileEntryModule = module
7
- }
8
-
9
- get type () {
10
- return 'mpx child compile'
11
- }
12
-
13
- updateHash (hash) {
14
- super.updateHash(hash)
15
- hash.update(this.childCompileEntryModule.identifier())
16
- }
17
- }
18
-
19
- ChildCompileDependency.Template = class ChildCompileDependencyTemplate {
20
- apply () {
21
- }
22
- }
23
-
24
- module.exports = ChildCompileDependency
@@ -1,26 +0,0 @@
1
- const NullDependency = require('webpack/lib/dependencies/NullDependency')
2
-
3
- class InjectDependency extends NullDependency {
4
- constructor (options) {
5
- super()
6
- this.content = options.content
7
- this.index = options.index || 0
8
- }
9
-
10
- get type () {
11
- return 'mpx inject'
12
- }
13
-
14
- updateHash (hash) {
15
- super.updateHash(hash)
16
- hash.update(this.content)
17
- }
18
- }
19
-
20
- InjectDependency.Template = class InjectDependencyTemplate {
21
- apply (dep, source) {
22
- source.insert(dep.index, '/* mpx inject */ ' + dep.content)
23
- }
24
- }
25
-
26
- module.exports = InjectDependency
@@ -1,23 +0,0 @@
1
- const ModuleDependency = require('webpack/lib/dependencies//ModuleDependency')
2
-
3
- class RemovedModuleDependency extends ModuleDependency {
4
- constructor (request, removedModule, range) {
5
- super(request)
6
- this.removedModule = removedModule
7
- this.range = range
8
- }
9
-
10
- get type () {
11
- return 'removed module'
12
- }
13
- }
14
-
15
- RemovedModuleDependency.Template = class RemovedModuleDependencyTemplate {
16
- apply (dep, source) {
17
- if (dep.range) {
18
- source.replace(dep.range[0], dep.range[1] - 1, '')
19
- }
20
- }
21
- }
22
-
23
- module.exports = RemovedModuleDependency
@@ -1,53 +0,0 @@
1
- const NullDependency = require('webpack/lib/dependencies/NullDependency')
2
- const parseRequest = require('../utils/parse-request')
3
-
4
- class ResolveDependency extends NullDependency {
5
- constructor (resource, packageName, pagesMap, componentsMap, staticResourcesMap, publicPath, range, issuerResource, compilation) {
6
- super()
7
- this.resource = resource
8
- this.packageName = packageName
9
- this.pagesMap = pagesMap
10
- this.componentsMap = componentsMap
11
- this.staticResourcesMap = staticResourcesMap
12
- this.publicPath = publicPath
13
- this.range = range
14
- this.issuerResource = issuerResource
15
- this.compilation = compilation
16
- }
17
-
18
- get type () {
19
- return 'mpx resolve'
20
- }
21
-
22
- updateHash (hash) {
23
- super.updateHash(hash)
24
- hash.update(this.resource)
25
- }
26
- }
27
-
28
- ResolveDependency.Template = class ResolveDependencyTemplate {
29
- apply (dep, source) {
30
- const content = this.getContent(dep)
31
- source.replace(dep.range[0], dep.range[1] - 1, content)
32
- }
33
-
34
- getContent (dep) {
35
- const resourcePath = parseRequest(dep.resource).resourcePath
36
- const pagesMap = dep.pagesMap
37
- const componentsMap = dep.componentsMap[dep.packageName]
38
- const mainComponentsMap = dep.componentsMap.main
39
- const staticResourcesMap = dep.staticResourcesMap[dep.packageName]
40
- const mainStaticResourcesMap = dep.staticResourcesMap.main
41
- const resolved = pagesMap[resourcePath] || componentsMap[resourcePath] || mainComponentsMap[resourcePath] || staticResourcesMap[resourcePath] || mainStaticResourcesMap[resourcePath] || ''
42
- if (!resolved) {
43
- dep.compilation.errors.push(new Error(`Path ${dep.resource} is not a page/component/static resource, which is resolved from ${dep.issuerResource}!`))
44
- }
45
- // for tenon
46
- if (dep.compilation.__mpx__.mode === 'tenon') {
47
- return `getRelativePath(currentURL, ${JSON.stringify(resolved)}) + '.js'`
48
- }
49
- return JSON.stringify(dep.publicPath + resolved)
50
- }
51
- }
52
-
53
- module.exports = ResolveDependency