@umijs/bundler-utils 4.0.0-rc.2 → 4.0.0-rc.5

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.
@@ -47932,7 +47932,7 @@ exports["default"] = _default;
47932
47932
 
47933
47933
  /***/ }),
47934
47934
 
47935
- /***/ 54061:
47935
+ /***/ 54734:
47936
47936
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
47937
47937
 
47938
47938
  "use strict";
@@ -48003,7 +48003,7 @@ exports["default"] = _default;
48003
48003
 
48004
48004
  /***/ }),
48005
48005
 
48006
- /***/ 56447:
48006
+ /***/ 75345:
48007
48007
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
48008
48008
 
48009
48009
  "use strict";
@@ -48016,7 +48016,7 @@ exports["default"] = void 0;
48016
48016
 
48017
48017
  var _core = __nccwpck_require__(21840);
48018
48018
 
48019
- var _buildOptimizedSequenceExpression = __nccwpck_require__(54061);
48019
+ var _buildOptimizedSequenceExpression = __nccwpck_require__(54734);
48020
48020
 
48021
48021
  const fsharpVisitor = {
48022
48022
  BinaryExpression(path) {
@@ -48046,7 +48046,7 @@ exports["default"] = _default;
48046
48046
 
48047
48047
  /***/ }),
48048
48048
 
48049
- /***/ 26602:
48049
+ /***/ 22841:
48050
48050
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
48051
48051
 
48052
48052
  "use strict";
@@ -48059,9 +48059,21 @@ exports["default"] = void 0;
48059
48059
 
48060
48060
  var _core = __nccwpck_require__(21840);
48061
48061
 
48062
- const topicReferenceReplacementVisitor = {
48063
- TopicReference(path) {
48064
- path.replaceWith(_core.types.cloneNode(this.topicVariable));
48062
+ const topicReferenceVisitor = {
48063
+ exit(path, state) {
48064
+ if (path.isTopicReference()) {
48065
+ state.topicReferences.push(path);
48066
+ } else {
48067
+ if (state.topicReferences.length === 0 && !state.sideEffectsBeforeFirstTopicReference && !path.isPure()) {
48068
+ state.sideEffectsBeforeFirstTopicReference = true;
48069
+ }
48070
+ }
48071
+ },
48072
+
48073
+ "ClassBody|Function"(_, state) {
48074
+ if (state.topicReferences.length === 0) {
48075
+ state.sideEffectsBeforeFirstTopicReference = true;
48076
+ }
48065
48077
  }
48066
48078
 
48067
48079
  };
@@ -48077,20 +48089,30 @@ var _default = {
48077
48089
  return;
48078
48090
  }
48079
48091
 
48080
- const topicVariable = scope.generateUidIdentifierBasedOnNode(node);
48081
48092
  const pipeBodyPath = path.get("right");
48082
- scope.push({
48083
- id: topicVariable
48084
- });
48085
48093
 
48086
48094
  if (pipeBodyPath.node.type === "TopicReference") {
48087
- pipeBodyPath.replaceWith(_core.types.cloneNode(topicVariable));
48088
- } else {
48089
- pipeBodyPath.traverse(topicReferenceReplacementVisitor, {
48090
- topicVariable
48091
- });
48095
+ path.replaceWith(node.left);
48096
+ return;
48097
+ }
48098
+
48099
+ const visitorState = {
48100
+ topicReferences: [],
48101
+ sideEffectsBeforeFirstTopicReference: pipeBodyPath.isFunction()
48102
+ };
48103
+ pipeBodyPath.traverse(topicReferenceVisitor, visitorState);
48104
+
48105
+ if (visitorState.topicReferences.length === 1 && (!visitorState.sideEffectsBeforeFirstTopicReference || path.scope.isPure(node.left, true))) {
48106
+ visitorState.topicReferences[0].replaceWith(node.left);
48107
+ path.replaceWith(node.right);
48108
+ return;
48092
48109
  }
48093
48110
 
48111
+ const topicVariable = scope.generateUidIdentifierBasedOnNode(node);
48112
+ scope.push({
48113
+ id: topicVariable
48114
+ });
48115
+ visitorState.topicReferences.forEach(path => path.replaceWith(_core.types.cloneNode(topicVariable)));
48094
48116
  path.replaceWith(_core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(topicVariable), node.left), node.right]));
48095
48117
  }
48096
48118
 
@@ -48100,7 +48122,7 @@ exports["default"] = _default;
48100
48122
 
48101
48123
  /***/ }),
48102
48124
 
48103
- /***/ 76595:
48125
+ /***/ 81081:
48104
48126
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
48105
48127
 
48106
48128
  "use strict";
@@ -48113,15 +48135,15 @@ exports["default"] = void 0;
48113
48135
 
48114
48136
  var _helperPluginUtils = __nccwpck_require__(41611);
48115
48137
 
48116
- var _pluginSyntaxPipelineOperator = __nccwpck_require__(35779);
48138
+ var _pluginSyntaxPipelineOperator = __nccwpck_require__(34827);
48117
48139
 
48118
- var _minimalVisitor = __nccwpck_require__(21742);
48140
+ var _minimalVisitor = __nccwpck_require__(67218);
48119
48141
 
48120
- var _hackVisitor = __nccwpck_require__(26602);
48142
+ var _hackVisitor = __nccwpck_require__(22841);
48121
48143
 
48122
- var _fsharpVisitor = __nccwpck_require__(56447);
48144
+ var _fsharpVisitor = __nccwpck_require__(75345);
48123
48145
 
48124
- var _smartVisitor = __nccwpck_require__(41745);
48146
+ var _smartVisitor = __nccwpck_require__(25083);
48125
48147
 
48126
48148
  const visitorsPerProposal = {
48127
48149
  minimal: _minimalVisitor.default,
@@ -48151,7 +48173,7 @@ exports["default"] = _default;
48151
48173
 
48152
48174
  /***/ }),
48153
48175
 
48154
- /***/ 21742:
48176
+ /***/ 67218:
48155
48177
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
48156
48178
 
48157
48179
  "use strict";
@@ -48164,7 +48186,7 @@ exports["default"] = void 0;
48164
48186
 
48165
48187
  var _core = __nccwpck_require__(21840);
48166
48188
 
48167
- var _buildOptimizedSequenceExpression = __nccwpck_require__(54061);
48189
+ var _buildOptimizedSequenceExpression = __nccwpck_require__(54734);
48168
48190
 
48169
48191
  const minimalVisitor = {
48170
48192
  BinaryExpression(path) {
@@ -48195,7 +48217,7 @@ exports["default"] = _default;
48195
48217
 
48196
48218
  /***/ }),
48197
48219
 
48198
- /***/ 41745:
48220
+ /***/ 25083:
48199
48221
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
48200
48222
 
48201
48223
  "use strict";
@@ -49147,7 +49169,7 @@ exports["default"] = _default;
49147
49169
 
49148
49170
  /***/ }),
49149
49171
 
49150
- /***/ 35779:
49172
+ /***/ 34827:
49151
49173
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
49152
49174
 
49153
49175
  "use strict";
@@ -49161,7 +49183,7 @@ exports["default"] = void 0;
49161
49183
  var _helperPluginUtils = __nccwpck_require__(41611);
49162
49184
 
49163
49185
  const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
49164
- const TOPIC_TOKENS = ["^", "%", "#"];
49186
+ const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
49165
49187
  const documentationURL = "https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator";
49166
49188
 
49167
49189
  var _default = (0, _helperPluginUtils.declare)((api, {
@@ -111892,7 +111914,7 @@ module.exports = {
111892
111914
  pluginProposalPartialApplication: () =>
111893
111915
  __nccwpck_require__(85537),
111894
111916
  pluginProposalPipelineOperator: () =>
111895
- __nccwpck_require__(76595),
111917
+ __nccwpck_require__(81081),
111896
111918
  pluginProposalRecordAndTuple: () =>
111897
111919
  __nccwpck_require__(6277),
111898
111920
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-utils",
3
- "version": "4.0.0-rc.2",
3
+ "version": "4.0.0-rc.5",
4
4
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi-next/issues",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "dev": "pnpm build -- --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@umijs/utils": "4.0.0-rc.2",
24
- "esbuild": "0.14.22"
23
+ "@umijs/utils": "4.0.0-rc.5",
24
+ "esbuild": "0.14.24"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@babel/code-frame": "7.16.7",
@@ -35,7 +35,7 @@
35
35
  "@babel/plugin-proposal-export-namespace-from": "7.16.7",
36
36
  "@babel/plugin-proposal-function-bind": "7.16.7",
37
37
  "@babel/plugin-proposal-partial-application": "7.16.7",
38
- "@babel/plugin-proposal-pipeline-operator": "7.16.7",
38
+ "@babel/plugin-proposal-pipeline-operator": "7.17.6",
39
39
  "@babel/plugin-proposal-record-and-tuple": "7.16.7",
40
40
  "@babel/plugin-transform-runtime": "7.17.0",
41
41
  "@babel/preset-env": "7.16.11",
@@ -51,7 +51,7 @@
51
51
  "@types/babel__template": "7.4.1",
52
52
  "@types/babel__traverse": "7.14.2",
53
53
  "cjs-module-lexer": "1.2.2",
54
- "es-module-lexer": "0.9.3"
54
+ "es-module-lexer": "0.10.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"