@dcloudio/uni-cli-shared 2.0.2-3061520221228002 → 2.0.2-3061720230112001
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/lib/index.js +5 -1
- package/lib/util.js +23 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -32,7 +32,9 @@ const {
|
|
|
32
32
|
normalizePath,
|
|
33
33
|
getComponentName,
|
|
34
34
|
convertStaticStyle,
|
|
35
|
-
getTemplatePath
|
|
35
|
+
getTemplatePath,
|
|
36
|
+
createSource,
|
|
37
|
+
deleteAsset
|
|
36
38
|
} = require('./util')
|
|
37
39
|
|
|
38
40
|
const {
|
|
@@ -108,6 +110,8 @@ module.exports = {
|
|
|
108
110
|
getComponentName,
|
|
109
111
|
convertStaticStyle,
|
|
110
112
|
getTemplatePath,
|
|
113
|
+
createSource,
|
|
114
|
+
deleteAsset,
|
|
111
115
|
jsPreprocessOptions,
|
|
112
116
|
cssPreprocessOptions,
|
|
113
117
|
htmlPreprocessOptions,
|
package/lib/util.js
CHANGED
|
@@ -4,6 +4,7 @@ const hash = require('hash-sum')
|
|
|
4
4
|
const crypto = require('crypto')
|
|
5
5
|
const escapeStringRegexp = require('escape-string-regexp')
|
|
6
6
|
const escapeGlob = require('glob-escape')
|
|
7
|
+
const webpack = require('webpack')
|
|
7
8
|
|
|
8
9
|
const isWin = /^win/.test(process.platform)
|
|
9
10
|
|
|
@@ -159,6 +160,25 @@ function isNormalPage (pagePath) {
|
|
|
159
160
|
return !pagePath.startsWith('ext://')
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
function createSource (content) {
|
|
164
|
+
return webpack.version[0] > 4 ? new webpack.sources.RawSource(content) : {
|
|
165
|
+
size () {
|
|
166
|
+
return Buffer.byteLength(content, 'utf8')
|
|
167
|
+
},
|
|
168
|
+
source () {
|
|
169
|
+
return content
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function deleteAsset (compilation, name) {
|
|
175
|
+
if ('deleteAsset' in compilation) {
|
|
176
|
+
compilation.deleteAsset(name)
|
|
177
|
+
} else {
|
|
178
|
+
delete compilation.assets[name]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
162
182
|
module.exports = {
|
|
163
183
|
isNormalPage,
|
|
164
184
|
isInHBuilderX,
|
|
@@ -198,5 +218,7 @@ module.exports = {
|
|
|
198
218
|
}),
|
|
199
219
|
getTemplatePath () {
|
|
200
220
|
return path.join(__dirname, '../template')
|
|
201
|
-
}
|
|
221
|
+
},
|
|
222
|
+
createSource,
|
|
223
|
+
deleteAsset
|
|
202
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-3061720230112001",
|
|
4
4
|
"description": "uni-cli-shared",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"postcss-urlrewrite": "^0.2.2",
|
|
26
26
|
"strip-json-comments": "^2.0.1"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "2d4422d48475c99a97a56a71b2eaebc0e3107f9d"
|
|
29
29
|
}
|