glass-easel-miniprogram-webpack-plugin 1.0.0 → 1.1.0
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/index.js +3 -0
- package/index.ts +7 -0
- package/package.json +5 -5
- package/wxss_loader.js +2 -2
package/index.js
CHANGED
|
@@ -155,6 +155,7 @@ class GlassEaselMiniprogramWebpackPlugin {
|
|
|
155
155
|
this.resourceFilePattern = options.resourceFilePattern || /\.(jpg|jpeg|png|gif)$/;
|
|
156
156
|
this.defaultEntry = options.defaultEntry || 'pages/index/index';
|
|
157
157
|
this.customBootstrap = options.customBootstrap || false;
|
|
158
|
+
this.tagNamePrefix = options.tagNamePrefix || '';
|
|
158
159
|
this.disableClassPrefix = options.disableClassPrefix || false;
|
|
159
160
|
this.disableHostConversion = options.disableHostConversion || false;
|
|
160
161
|
}
|
|
@@ -375,6 +376,7 @@ class GlassEaselMiniprogramWebpackPlugin {
|
|
|
375
376
|
}
|
|
376
377
|
else {
|
|
377
378
|
x.options = {
|
|
379
|
+
tagNamePrefix: this.tagNamePrefix,
|
|
378
380
|
classPrefix: styleSheetManager.getScopeName(compPath),
|
|
379
381
|
disableHostConversion: styleSheetManager.disableHostConversion,
|
|
380
382
|
setLowPriorityStyles: (s, map) => {
|
|
@@ -520,6 +522,7 @@ class GlassEaselMiniprogramWebpackPlugin {
|
|
|
520
522
|
var env = new adapter.MiniProgramEnv()
|
|
521
523
|
exports.env = env
|
|
522
524
|
var codeSpace = env.createCodeSpace('', true)
|
|
525
|
+
codeSpace.getComponentSpace().updateComponentOptions({ hostNodeTagName: '${this.tagNamePrefix}*' })
|
|
523
526
|
codeSpace.addStyleSheet('app', 'app')
|
|
524
527
|
exports.codeSpace = codeSpace
|
|
525
528
|
exports.genObjectGroups = ${tmplGroup ? tmplGroup.getTmplGenObjectGroups() : '{}'}
|
package/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ type PluginConfig = {
|
|
|
43
43
|
resourceFilePattern: RegExp
|
|
44
44
|
defaultEntry: string
|
|
45
45
|
customBootstrap: boolean
|
|
46
|
+
tagNamePrefix: string
|
|
46
47
|
disableClassPrefix: boolean
|
|
47
48
|
disableHostConversion: boolean
|
|
48
49
|
}
|
|
@@ -185,6 +186,7 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
|
|
|
185
186
|
resourceFilePattern: RegExp
|
|
186
187
|
defaultEntry: string
|
|
187
188
|
customBootstrap: boolean
|
|
189
|
+
tagNamePrefix: string
|
|
188
190
|
disableClassPrefix: boolean
|
|
189
191
|
disableHostConversion: boolean
|
|
190
192
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
@@ -196,6 +198,7 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
|
|
|
196
198
|
this.resourceFilePattern = options.resourceFilePattern || /\.(jpg|jpeg|png|gif)$/
|
|
197
199
|
this.defaultEntry = options.defaultEntry || 'pages/index/index'
|
|
198
200
|
this.customBootstrap = options.customBootstrap || false
|
|
201
|
+
this.tagNamePrefix = options.tagNamePrefix || ''
|
|
199
202
|
this.disableClassPrefix = options.disableClassPrefix || false
|
|
200
203
|
this.disableHostConversion = options.disableHostConversion || false
|
|
201
204
|
}
|
|
@@ -431,6 +434,7 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
|
|
|
431
434
|
loaders.splice(i, loaders.length - i)
|
|
432
435
|
} else {
|
|
433
436
|
x.options = {
|
|
437
|
+
tagNamePrefix: this.tagNamePrefix,
|
|
434
438
|
classPrefix: styleSheetManager.getScopeName(compPath),
|
|
435
439
|
disableHostConversion: styleSheetManager.disableHostConversion,
|
|
436
440
|
setLowPriorityStyles: (s: string, map: string) => {
|
|
@@ -584,6 +588,9 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
|
|
|
584
588
|
var env = new adapter.MiniProgramEnv()
|
|
585
589
|
exports.env = env
|
|
586
590
|
var codeSpace = env.createCodeSpace('', true)
|
|
591
|
+
codeSpace.getComponentSpace().updateComponentOptions({ hostNodeTagName: '${
|
|
592
|
+
this.tagNamePrefix
|
|
593
|
+
}*' })
|
|
587
594
|
codeSpace.addStyleSheet('app', 'app')
|
|
588
595
|
exports.codeSpace = codeSpace
|
|
589
596
|
exports.genObjectGroups = ${tmplGroup ? tmplGroup.getTmplGenObjectGroups() : '{}'}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glass-easel-miniprogram-webpack-plugin",
|
|
3
3
|
"description": "The webpack plugin of the glass-easel project for MiniProgram file structure",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/wechat-miniprogram/glass-easel.git"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"webpack": "^5.101.3",
|
|
21
|
-
"glass-easel": "1.
|
|
22
|
-
"glass-easel-miniprogram-adapter": "1.
|
|
21
|
+
"glass-easel": "1.1.0",
|
|
22
|
+
"glass-easel-miniprogram-adapter": "1.1.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"chalk": "4",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"source-map": "^0.7.4",
|
|
28
28
|
"webpack-sources": "^3.2.1",
|
|
29
29
|
"webpack-virtual-modules": "^0.5.0",
|
|
30
|
-
"glass-easel-stylesheet-compiler": "1.
|
|
31
|
-
"glass-easel-template-compiler": "1.
|
|
30
|
+
"glass-easel-stylesheet-compiler": "1.1.0",
|
|
31
|
+
"glass-easel-template-compiler": "1.1.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsc -p .",
|
package/wxss_loader.js
CHANGED
|
@@ -6,8 +6,8 @@ const { StyleSheetTransformer } = require('glass-easel-stylesheet-compiler')
|
|
|
6
6
|
|
|
7
7
|
module.exports = function (src, prevMap, meta) {
|
|
8
8
|
const callback = this.async()
|
|
9
|
-
const { classPrefix, disableHostConversion, setLowPriorityStyles } = this.query
|
|
10
|
-
const sst = new StyleSheetTransformer(this.resourcePath, src, classPrefix, 750, !disableHostConversion)
|
|
9
|
+
const { tagNamePrefix, classPrefix, disableHostConversion, setLowPriorityStyles } = this.query
|
|
10
|
+
const sst = new StyleSheetTransformer(this.resourcePath, src, classPrefix, 750, !disableHostConversion, tagNamePrefix)
|
|
11
11
|
setLowPriorityStyles(sst.getLowPriorityContent(), sst.getLowPrioritySourceMap())
|
|
12
12
|
const warnings = sst.extractWarnings()
|
|
13
13
|
if (warnings && warnings.length > 0) {
|