@arkxio/ark-dev-utils 0.1.10 → 0.1.12

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/dist/index.js CHANGED
@@ -1228,45 +1228,22 @@
1228
1228
  }
1229
1229
 
1230
1230
  let content = source.source().toString();
1231
-
1232
- // 替换逻辑
1233
- // /(__webpack_require__\.l)\(url,/g)
1234
- // const webpackRequireLPattern = /(__webpack_require__\.l)\(url,/g;
1235
- // if (webpackRequireLPattern.test(content)) {
1236
- // verbose('检测到 __webpack_require__.l 模式');
1237
- // content = content.replace(
1238
- // webpackRequireLPattern,
1239
- // `(function(url, done, key, chunkId) {
1240
- // if (typeof window.ArkConfig !== 'undefined' && window.ArkConfig.cdnHost) {
1241
- // if (!url.startsWith(window.ArkConfig.cdnHost) && url.startsWith('https://unpkg.com')) {
1242
- // url = window.ArkConfig.cdnHost + url.slice('https://unpkg.com'.length);
1243
- // }
1244
- // }
1245
- // return $1(url, done, key, chunkId);
1246
- // })(url,`
1247
- // );
1248
-
1249
- let findUnpkgModel = false;
1250
1231
  const webpackRequireLPatternEval = /"https:\/\/unpkg\.com"/g;
1251
- if (webpackRequireLPatternEval.test(content)) {
1232
+ // if (webpackRequireLPatternEval.test(content)) {
1233
+ // webpackRequireLPatternEval.lastIndex = 0;
1234
+ verbose('检测到 转码 unpkg.com 模式');
1252
1235
  content = content.replace(webpackRequireLPatternEval, 'window.ArkConfig.cdnHost');
1253
- findUnpkgModel = true;
1254
- }
1236
+ // }
1255
1237
 
1256
1238
  const webpackRequireLPattern = /"(https:\/\/unpkg\.com)/g;
1257
- if (webpackRequireLPattern.test(content)) {
1258
- findUnpkgModel = true;
1259
1239
  verbose('检测到 unpkg.com 模式');
1260
- content = content.replace(
1261
- webpackRequireLPattern,
1262
- `window.ArkConfig.cdnHost + "`
1263
- );
1264
- }
1240
+ content = content.replace(webpackRequireLPattern,`window.ArkConfig.cdnHost + "`);
1241
+ // }
1265
1242
 
1266
- if (findUnpkgModel) {
1243
+ // if (findUnpkgModel) {
1267
1244
  // 更新资源
1268
1245
  compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(content));
1269
- }
1246
+ // }
1270
1247
 
1271
1248
  });
1272
1249
  }
package/dist/index.min.js CHANGED
@@ -1228,45 +1228,22 @@
1228
1228
  }
1229
1229
 
1230
1230
  let content = source.source().toString();
1231
-
1232
- // 替换逻辑
1233
- // /(__webpack_require__\.l)\(url,/g)
1234
- // const webpackRequireLPattern = /(__webpack_require__\.l)\(url,/g;
1235
- // if (webpackRequireLPattern.test(content)) {
1236
- // verbose('检测到 __webpack_require__.l 模式');
1237
- // content = content.replace(
1238
- // webpackRequireLPattern,
1239
- // `(function(url, done, key, chunkId) {
1240
- // if (typeof window.ArkConfig !== 'undefined' && window.ArkConfig.cdnHost) {
1241
- // if (!url.startsWith(window.ArkConfig.cdnHost) && url.startsWith('https://unpkg.com')) {
1242
- // url = window.ArkConfig.cdnHost + url.slice('https://unpkg.com'.length);
1243
- // }
1244
- // }
1245
- // return $1(url, done, key, chunkId);
1246
- // })(url,`
1247
- // );
1248
-
1249
- let findUnpkgModel = false;
1250
1231
  const webpackRequireLPatternEval = /"https:\/\/unpkg\.com"/g;
1251
- if (webpackRequireLPatternEval.test(content)) {
1232
+ // if (webpackRequireLPatternEval.test(content)) {
1233
+ // webpackRequireLPatternEval.lastIndex = 0;
1234
+ verbose('检测到 转码 unpkg.com 模式');
1252
1235
  content = content.replace(webpackRequireLPatternEval, 'window.ArkConfig.cdnHost');
1253
- findUnpkgModel = true;
1254
- }
1236
+ // }
1255
1237
 
1256
1238
  const webpackRequireLPattern = /"(https:\/\/unpkg\.com)/g;
1257
- if (webpackRequireLPattern.test(content)) {
1258
- findUnpkgModel = true;
1259
1239
  verbose('检测到 unpkg.com 模式');
1260
- content = content.replace(
1261
- webpackRequireLPattern,
1262
- `window.ArkConfig.cdnHost + "`
1263
- );
1264
- }
1240
+ content = content.replace(webpackRequireLPattern,`window.ArkConfig.cdnHost + "`);
1241
+ // }
1265
1242
 
1266
- if (findUnpkgModel) {
1243
+ // if (findUnpkgModel) {
1267
1244
  // 更新资源
1268
1245
  compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(content));
1269
- }
1246
+ // }
1270
1247
 
1271
1248
  });
1272
1249
  }
package/lib/index.js CHANGED
@@ -1233,45 +1233,22 @@ class ArkWebpackPlugin {
1233
1233
  }
1234
1234
 
1235
1235
  let content = source.source().toString();
1236
-
1237
- // 替换逻辑
1238
- // /(__webpack_require__\.l)\(url,/g)
1239
- // const webpackRequireLPattern = /(__webpack_require__\.l)\(url,/g;
1240
- // if (webpackRequireLPattern.test(content)) {
1241
- // verbose('检测到 __webpack_require__.l 模式');
1242
- // content = content.replace(
1243
- // webpackRequireLPattern,
1244
- // `(function(url, done, key, chunkId) {
1245
- // if (typeof window.ArkConfig !== 'undefined' && window.ArkConfig.cdnHost) {
1246
- // if (!url.startsWith(window.ArkConfig.cdnHost) && url.startsWith('https://unpkg.com')) {
1247
- // url = window.ArkConfig.cdnHost + url.slice('https://unpkg.com'.length);
1248
- // }
1249
- // }
1250
- // return $1(url, done, key, chunkId);
1251
- // })(url,`
1252
- // );
1253
-
1254
- let findUnpkgModel = false;
1255
1236
  const webpackRequireLPatternEval = /"https:\/\/unpkg\.com"/g;
1256
- if (webpackRequireLPatternEval.test(content)) {
1237
+ // if (webpackRequireLPatternEval.test(content)) {
1238
+ // webpackRequireLPatternEval.lastIndex = 0;
1239
+ verbose('检测到 转码 unpkg.com 模式');
1257
1240
  content = content.replace(webpackRequireLPatternEval, 'window.ArkConfig.cdnHost');
1258
- findUnpkgModel = true;
1259
- }
1241
+ // }
1260
1242
 
1261
1243
  const webpackRequireLPattern = /"(https:\/\/unpkg\.com)/g;
1262
- if (webpackRequireLPattern.test(content)) {
1263
- findUnpkgModel = true;
1264
1244
  verbose('检测到 unpkg.com 模式');
1265
- content = content.replace(
1266
- webpackRequireLPattern,
1267
- `window.ArkConfig.cdnHost + "`
1268
- );
1269
- }
1245
+ content = content.replace(webpackRequireLPattern,`window.ArkConfig.cdnHost + "`);
1246
+ // }
1270
1247
 
1271
- if (findUnpkgModel) {
1248
+ // if (findUnpkgModel) {
1272
1249
  // 更新资源
1273
1250
  compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(content));
1274
- }
1251
+ // }
1275
1252
 
1276
1253
  });
1277
1254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkxio/ark-dev-utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "ark dev utils",
5
5
  "repository": {
6
6
  "type": "git",
@@ -73,25 +73,25 @@ export default class ArkWebpackPlugin {
73
73
 
74
74
  let findUnpkgModel = false;
75
75
  const webpackRequireLPatternEval = /"https:\/\/unpkg\.com"/g;
76
- if (webpackRequireLPatternEval.test(content)) {
76
+ // if (webpackRequireLPatternEval.test(content)) {
77
+ // webpackRequireLPatternEval.lastIndex = 0;
78
+ verbose('检测到 转码 unpkg.com 模式');
77
79
  content = content.replace(webpackRequireLPatternEval, 'window.ArkConfig.cdnHost');
78
80
  findUnpkgModel = true;
79
- }
81
+ // }
80
82
 
81
83
  const webpackRequireLPattern = /"(https:\/\/unpkg\.com)/g;
82
- if (webpackRequireLPattern.test(content)) {
84
+ // if (webpackRequireLPattern.test(content)) {
85
+ // webpackRequireLPattern.lastIndex = 0;
83
86
  findUnpkgModel = true;
84
87
  verbose('检测到 unpkg.com 模式');
85
- content = content.replace(
86
- webpackRequireLPattern,
87
- `window.ArkConfig.cdnHost + "`
88
- );
89
- }
88
+ content = content.replace(webpackRequireLPattern,`window.ArkConfig.cdnHost + "`);
89
+ // }
90
90
 
91
- if (findUnpkgModel) {
91
+ // if (findUnpkgModel) {
92
92
  // 更新资源
93
93
  compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(content));
94
- }
94
+ // }
95
95
 
96
96
  });
97
97
  }