@dcloudio/vue-cli-plugin-uni 2.0.1-alpha-36920221111002 → 2.0.1-alpha-36920221114002

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.1-alpha-36920221111002",
3
+ "version": "2.0.1-alpha-36920221114002",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.1-alpha-36920221111002",
20
+ "@dcloudio/uni-stat": "^2.0.1-alpha-36920221114002",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "cross-env": "^5.2.0",
@@ -41,5 +41,5 @@
41
41
  "copy-webpack-plugin": ">=5",
42
42
  "postcss": ">=7"
43
43
  },
44
- "gitHead": "dc2bac7acb55d4569841b7487b4968ff7dc834c6"
44
+ "gitHead": "b54a41b95819e420dac9fb6ca5fe8c8d44021ece"
45
45
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var __importStar = (this && this.__importStar) || function(mod) {
2
+ var __importStar = (this && this.__importStar) || function (mod) {
3
3
  if (mod && mod.__esModule) return mod;
4
4
  var result = {};
5
5
  if (mod != null)
@@ -14,8 +14,8 @@ Object.defineProperty(exports, "__esModule", {
14
14
  const postcss = __importStar(require("postcss"));
15
15
  // postcss-selector-parser does have typings but it's problematic to work with.
16
16
  const selectorParser = require('postcss-selector-parser');
17
- exports.default = postcss.plugin('remove-scoped', (options) => (root) => {
18
- root.each(function rewriteSelector(node) {
17
+ const once = (root) => {
18
+ root.each(function rewriteSelector (node) {
19
19
  if (!node.selector) {
20
20
  // handle media queries
21
21
  if (node.type === 'atrule') {
@@ -58,4 +58,22 @@ exports.default = postcss.plugin('remove-scoped', (options) => (root) => {
58
58
  });
59
59
  }).processSync(node.selector);
60
60
  });
61
- });
61
+ };
62
+
63
+ const version = Number(require('postcss/package.json').version.split('.')[0])
64
+
65
+ if (version < 8) {
66
+ const postcss = require('postcss')
67
+ module.exports = postcss.plugin('remove-scoped', function (opts) {
68
+ return once
69
+ })
70
+ } else {
71
+ module.exports = function (opts) {
72
+ return {
73
+ postcssPlugin: 'remove-scoped',
74
+ Once: once
75
+ }
76
+ }
77
+
78
+ module.exports.postcss = true
79
+ }
@@ -1,112 +1,130 @@
1
1
  "use strict";
2
2
  var __importStar = (this && this.__importStar) || function (mod) {
3
- if (mod && mod.__esModule) return mod;
4
- var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
7
- return result;
3
+ if (mod && mod.__esModule) return mod;
4
+ var result = {};
5
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
+ result["default"] = mod;
7
+ return result;
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const postcss = __importStar(require("postcss"));
11
11
  // postcss-selector-parser does have typings but it's problematic to work with.
12
12
  const selectorParser = require('postcss-selector-parser');
13
- exports.default = postcss.plugin('add-id', (options) => (root) => {
14
- const id = options;
15
- const keyframes = Object.create(null);
16
- root.each(function rewriteSelector(node) {
17
- if (!node.selector) {
18
- // handle media queries
19
- if (node.type === 'atrule') {
20
- if (node.name === 'media' || node.name === 'supports') {
21
- node.each(rewriteSelector);
22
- }
23
- else if (/-?keyframes$/.test(node.name)) {
24
- // register keyframes
25
- keyframes[node.params] = node.params = node.params + '-' + id;
26
- }
27
- }
28
- return;
13
+ const once = (options) => (root) => {
14
+ const id = options;
15
+ const keyframes = Object.create(null);
16
+ root.each(function rewriteSelector (node) {
17
+ if (!node.selector) {
18
+ // handle media queries
19
+ if (node.type === 'atrule') {
20
+ if (node.name === 'media' || node.name === 'supports') {
21
+ node.each(rewriteSelector);
29
22
  }
30
- node.selector = selectorParser((selectors) => {
31
- selectors.each((selector) => {
32
- let node = null;
33
- // find the last child node to insert attribute selector
34
- selector.each((n) => {
35
- // ">>>" combinator
36
- // and /deep/ alias for >>>, since >>> doesn't work in SASS
37
- if (n.type === 'combinator' &&
38
- (n.value === '>>>' || n.value === '/deep/')) {
39
- n.value = ' ';
40
- n.spaces.before = n.spaces.after = '';
41
- return false;
42
- }
43
- // in newer versions of sass, /deep/ support is also dropped, so add a ::v-deep alias
44
- if (n.type === 'pseudo' && n.value === '::v-deep') {
45
- n.value = n.spaces.before = n.spaces.after = '';
46
- return false;
47
- }
48
- if (n.type !== 'pseudo' && n.type !== 'combinator') {
49
- node = n;
50
- }
51
- });
52
- if (node) {
53
- node.spaces.after = '';
54
- }
55
- else {
56
- // For deep selectors & standalone pseudo selectors,
57
- // the attribute selectors are prepended rather than appended.
58
- // So all leading spaces must be eliminated to avoid problems.
59
- selector.first.spaces.before = '';
60
- }
61
- // fixed by xxxxxx (h5,app-plus v3 平台继续使用 attribute,其他平台使用 className)
62
- if(
63
- process.env.UNI_PLATFORM === 'h5' ||
64
- (
65
- process.env.UNI_PLATFORM === 'app-plus' &&
66
- process.env.UNI_USING_V3
67
- )
68
- ){
69
- selector.insertAfter(node, selectorParser.attribute({
70
- attribute: id
71
- }));
72
- } else {
73
- selector.insertAfter(node, selectorParser.className({
74
- value: id
75
- }));
76
- }
77
- });
78
- }).processSync(node.selector);
79
- });
80
- // If keyframes are found in this <style>, find and rewrite animation names
81
- // in declarations.
82
- // Caveat: this only works for keyframes and animation rules in the same
83
- // <style> element.
84
- if (Object.keys(keyframes).length) {
85
- root.walkDecls(decl => {
86
- // individual animation-name declaration
87
- if (/^(-\w+-)?animation-name$/.test(decl.prop)) {
88
- decl.value = decl.value
89
- .split(',')
90
- .map(v => keyframes[v.trim()] || v.trim())
91
- .join(',');
23
+ else if (/-?keyframes$/.test(node.name)) {
24
+ // register keyframes
25
+ keyframes[node.params] = node.params = node.params + '-' + id;
26
+ }
27
+ }
28
+ return;
29
+ }
30
+ node.selector = selectorParser((selectors) => {
31
+ selectors.each((selector) => {
32
+ let node = null;
33
+ // find the last child node to insert attribute selector
34
+ selector.each((n) => {
35
+ // ">>>" combinator
36
+ // and /deep/ alias for >>>, since >>> doesn't work in SASS
37
+ if (n.type === 'combinator' &&
38
+ (n.value === '>>>' || n.value === '/deep/')) {
39
+ n.value = ' ';
40
+ n.spaces.before = n.spaces.after = '';
41
+ return false;
42
+ }
43
+ // in newer versions of sass, /deep/ support is also dropped, so add a ::v-deep alias
44
+ if (n.type === 'pseudo' && n.value === '::v-deep') {
45
+ n.value = n.spaces.before = n.spaces.after = '';
46
+ return false;
47
+ }
48
+ if (n.type !== 'pseudo' && n.type !== 'combinator') {
49
+ node = n;
50
+ }
51
+ });
52
+ if (node) {
53
+ node.spaces.after = '';
54
+ }
55
+ else {
56
+ // For deep selectors & standalone pseudo selectors,
57
+ // the attribute selectors are prepended rather than appended.
58
+ // So all leading spaces must be eliminated to avoid problems.
59
+ selector.first.spaces.before = '';
60
+ }
61
+ // fixed by xxxxxx (h5,app-plus v3 平台继续使用 attribute,其他平台使用 className)
62
+ if (
63
+ process.env.UNI_PLATFORM === 'h5' ||
64
+ (
65
+ process.env.UNI_PLATFORM === 'app-plus' &&
66
+ process.env.UNI_USING_V3
67
+ )
68
+ ) {
69
+ selector.insertAfter(node, selectorParser.attribute({
70
+ attribute: id
71
+ }));
72
+ } else {
73
+ selector.insertAfter(node, selectorParser.className({
74
+ value: id
75
+ }));
76
+ }
77
+ });
78
+ }).processSync(node.selector);
79
+ });
80
+ // If keyframes are found in this <style>, find and rewrite animation names
81
+ // in declarations.
82
+ // Caveat: this only works for keyframes and animation rules in the same
83
+ // <style> element.
84
+ if (Object.keys(keyframes).length) {
85
+ root.walkDecls(decl => {
86
+ // individual animation-name declaration
87
+ if (/^(-\w+-)?animation-name$/.test(decl.prop)) {
88
+ decl.value = decl.value
89
+ .split(',')
90
+ .map(v => keyframes[v.trim()] || v.trim())
91
+ .join(',');
92
+ }
93
+ // shorthand
94
+ if (/^(-\w+-)?animation$/.test(decl.prop)) {
95
+ decl.value = decl.value
96
+ .split(',')
97
+ .map(v => {
98
+ const vals = v.trim().split(/\s+/);
99
+ const i = vals.findIndex(val => keyframes[val]);
100
+ if (i !== -1) {
101
+ vals.splice(i, 1, keyframes[vals[i]]);
102
+ return vals.join(' ');
92
103
  }
93
- // shorthand
94
- if (/^(-\w+-)?animation$/.test(decl.prop)) {
95
- decl.value = decl.value
96
- .split(',')
97
- .map(v => {
98
- const vals = v.trim().split(/\s+/);
99
- const i = vals.findIndex(val => keyframes[val]);
100
- if (i !== -1) {
101
- vals.splice(i, 1, keyframes[vals[i]]);
102
- return vals.join(' ');
103
- }
104
- else {
105
- return v;
106
- }
107
- })
108
- .join(',');
104
+ else {
105
+ return v;
109
106
  }
110
- });
107
+ })
108
+ .join(',');
109
+ }
110
+ });
111
+ }
112
+ };
113
+
114
+ const version = Number(require('postcss/package.json').version.split('.')[0])
115
+
116
+ if (version < 8) {
117
+ const postcss = require('postcss')
118
+ module.exports = postcss.plugin('add-id', function (opts) {
119
+ return once(opts)
120
+ })
121
+ } else {
122
+ module.exports = function (opts) {
123
+ return {
124
+ postcssPlugin: 'add-id',
125
+ Once: once(opts)
111
126
  }
112
- });
127
+ }
128
+
129
+ module.exports.postcss = true
130
+ }
@@ -1,20 +1,38 @@
1
1
  "use strict";
2
2
  var __importStar = (this && this.__importStar) || function (mod) {
3
- if (mod && mod.__esModule) return mod;
4
- var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
7
- return result;
3
+ if (mod && mod.__esModule) return mod;
4
+ var result = {};
5
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
+ result["default"] = mod;
7
+ return result;
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const postcss = __importStar(require("postcss"));
11
- exports.default = postcss.plugin('trim', () => (css) => {
12
- css.walk(({ type, raws }) => {
13
- if (type === 'rule' || type === 'atrule') {
14
- if (raws.before)
15
- raws.before = '\n';
16
- if (raws.after)
17
- raws.after = '\n';
18
- }
19
- });
20
- });
11
+ const once = (css) => {
12
+ css.walk(({ type, raws }) => {
13
+ if (type === 'rule' || type === 'atrule') {
14
+ if (raws.before)
15
+ raws.before = '\n';
16
+ if (raws.after)
17
+ raws.after = '\n';
18
+ }
19
+ });
20
+ };
21
+
22
+ const version = Number(require('postcss/package.json').version.split('.')[0])
23
+
24
+ if (version < 8) {
25
+ const postcss = require('postcss')
26
+ module.exports = postcss.plugin('trim', function (opts) {
27
+ return once
28
+ })
29
+ } else {
30
+ module.exports = function (opts) {
31
+ return {
32
+ postcssPlugin: 'trim',
33
+ Once: once
34
+ }
35
+ }
36
+
37
+ module.exports.postcss = true
38
+ }