@modern-js/plugin-data-loader 2.11.0 → 2.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @modern-js/plugin-data-loader
2
2
 
3
+ ## 2.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3d5086b: feat: the rspack unsupport inline loader, so we move data-loader to bundler.module.rules
8
+ feat: rspack 不支持 inline loader, 所以我们将 data-loader 移动到 bundler.module.rules 配置中去。
9
+
10
+ ### Patch Changes
11
+
12
+ - @modern-js/utils@2.13.0
13
+
14
+ ## 2.12.0
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [c2ca6c8]
19
+ - Updated dependencies [6d86e34]
20
+ - @modern-js/utils@2.12.0
21
+
3
22
  ## 2.11.0
4
23
 
5
24
  ### Patch Changes
@@ -31,7 +31,20 @@ async function loader(source) {
31
31
  if (target === "webworker") {
32
32
  return source;
33
33
  }
34
- const options = this.getOptions();
34
+ const { resourceQuery } = this;
35
+ const options = resourceQuery.slice(1).split("&").map((item) => {
36
+ return item.split("=");
37
+ }).reduce((pre, cur) => {
38
+ const [key, value] = cur;
39
+ if (!key || !value) {
40
+ return pre;
41
+ }
42
+ pre[key] = value;
43
+ return pre;
44
+ }, {});
45
+ if (!options.mapFile) {
46
+ return source;
47
+ }
35
48
  const code = (0, import_generateClient.generateClient)({
36
49
  mapFile: options.mapFile,
37
50
  loaderId: options.loaderId
@@ -1,3 +1,11 @@
1
+ function _arrayLikeToArray(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _arrayWithHoles(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
10
  try {
3
11
  var info = gen[key](arg);
@@ -27,6 +35,44 @@ function _asyncToGenerator(fn) {
27
35
  });
28
36
  };
29
37
  }
38
+ function _iterableToArrayLimit(arr, i) {
39
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
40
+ if (_i == null) return;
41
+ var _arr = [];
42
+ var _n = true;
43
+ var _d = false;
44
+ var _s, _e;
45
+ try {
46
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
47
+ _arr.push(_s.value);
48
+ if (i && _arr.length === i) break;
49
+ }
50
+ } catch (err) {
51
+ _d = true;
52
+ _e = err;
53
+ } finally{
54
+ try {
55
+ if (!_n && _i["return"] != null) _i["return"]();
56
+ } finally{
57
+ if (_d) throw _e;
58
+ }
59
+ }
60
+ return _arr;
61
+ }
62
+ function _nonIterableRest() {
63
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
+ }
65
+ function _slicedToArray(arr, i) {
66
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
67
+ }
68
+ function _unsupportedIterableToArray(o, minLen) {
69
+ if (!o) return;
70
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
71
+ var n = Object.prototype.toString.call(o).slice(8, -1);
72
+ if (n === "Object" && o.constructor) n = o.constructor.name;
73
+ if (n === "Map" || n === "Set") return Array.from(n);
74
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
75
+ }
30
76
  var __generator = this && this.__generator || function(thisArg, body) {
31
77
  var f, y, t, g, _ = {
32
78
  label: 0,
@@ -128,7 +174,7 @@ function loader(source) {
128
174
  }
129
175
  function _loader() {
130
176
  _loader = _asyncToGenerator(function(source) {
131
- var _this__compiler, target, options, code;
177
+ var _this__compiler, target, resourceQuery, options, code;
132
178
  return __generator(this, function(_state) {
133
179
  this.cacheable();
134
180
  target = (_this__compiler = this._compiler) === null || _this__compiler === void 0 ? void 0 : _this__compiler.options.target;
@@ -144,7 +190,23 @@ function _loader() {
144
190
  source
145
191
  ];
146
192
  }
147
- options = this.getOptions();
193
+ resourceQuery = this.resourceQuery;
194
+ options = resourceQuery.slice(1).split("&").map(function(item) {
195
+ return item.split("=");
196
+ }).reduce(function(pre, cur) {
197
+ var _cur = _slicedToArray(cur, 2), key = _cur[0], value = _cur[1];
198
+ if (!key || !value) {
199
+ return pre;
200
+ }
201
+ pre[key] = value;
202
+ return pre;
203
+ }, {});
204
+ if (!options.mapFile) {
205
+ return [
206
+ 2,
207
+ source
208
+ ];
209
+ }
148
210
  code = generateClient({
149
211
  mapFile: options.mapFile,
150
212
  loaderId: options.loaderId
@@ -9,7 +9,20 @@ async function loader(source) {
9
9
  if (target === "webworker") {
10
10
  return source;
11
11
  }
12
- const options = this.getOptions();
12
+ const { resourceQuery } = this;
13
+ const options = resourceQuery.slice(1).split("&").map((item) => {
14
+ return item.split("=");
15
+ }).reduce((pre, cur) => {
16
+ const [key, value] = cur;
17
+ if (!key || !value) {
18
+ return pre;
19
+ }
20
+ pre[key] = value;
21
+ return pre;
22
+ }, {});
23
+ if (!options.mapFile) {
24
+ return source;
25
+ }
13
26
  const code = generateClient({
14
27
  mapFile: options.mapFile,
15
28
  loaderId: options.loaderId
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.11.0",
14
+ "version": "2.13.0",
15
15
  "engines": {
16
16
  "node": ">=14.17.6"
17
17
  },
@@ -55,7 +55,7 @@
55
55
  "@remix-run/node": "^1.12.0",
56
56
  "path-to-regexp": "^6.2.0",
57
57
  "react-router-dom": "^6.8.1",
58
- "@modern-js/utils": "2.11.0"
58
+ "@modern-js/utils": "2.13.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/babel__core": "^7.1.15",
@@ -72,11 +72,11 @@
72
72
  "webpack-chain": "^6.5.1",
73
73
  "react": ">=17.0.0",
74
74
  "react-router-dom": "^6.8.1",
75
- "@modern-js/core": "2.11.0",
76
- "@modern-js/server-core": "2.11.0",
77
- "@modern-js/types": "2.11.0",
78
- "@scripts/build": "2.11.0",
79
- "@scripts/jest-config": "2.11.0"
75
+ "@modern-js/core": "2.13.0",
76
+ "@modern-js/server-core": "2.13.0",
77
+ "@modern-js/types": "2.13.0",
78
+ "@scripts/build": "2.13.0",
79
+ "@scripts/jest-config": "2.13.0"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": ">=17.0.0",