@mbler/mcx-core 0.0.7-alpha.r2 → 0.0.7-rc.1
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 +8 -7
- package/dist/index.js.map +1 -1
- package/dist/types/transforms/utils.d.ts +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -670,8 +670,8 @@ class Utils {
|
|
|
670
670
|
// first verify ir.raw
|
|
671
671
|
if (ir?.raw && Utils.CheckImportNode(ir?.raw, ir))
|
|
672
672
|
return ir.raw;
|
|
673
|
-
|
|
674
|
-
for (
|
|
673
|
+
const result = [];
|
|
674
|
+
for (const ImportIt of ir.imported) {
|
|
675
675
|
if (!ImportIt)
|
|
676
676
|
continue;
|
|
677
677
|
if (ImportIt.isAll) {
|
|
@@ -690,7 +690,7 @@ class Utils {
|
|
|
690
690
|
}
|
|
691
691
|
static ImportToCache(node) {
|
|
692
692
|
const result = [];
|
|
693
|
-
for (
|
|
693
|
+
for (const item of node.specifiers) {
|
|
694
694
|
const thisName = item.local.name;
|
|
695
695
|
if (item.type == "ImportNamespaceSpecifier") {
|
|
696
696
|
result.push({
|
|
@@ -855,7 +855,7 @@ class CompileJS {
|
|
|
855
855
|
}
|
|
856
856
|
writeBuildCache() {
|
|
857
857
|
const currenySource = [];
|
|
858
|
-
|
|
858
|
+
const build = [];
|
|
859
859
|
for (const [as, data] of Object.entries(this.indexTemp)) {
|
|
860
860
|
if (!this.writeImportKeys.includes(as))
|
|
861
861
|
continue;
|
|
@@ -1497,7 +1497,7 @@ class McxUtlis {
|
|
|
1497
1497
|
try {
|
|
1498
1498
|
text = JSON.parse(buffer.toString()); // Buffer -> string -> object
|
|
1499
1499
|
}
|
|
1500
|
-
catch
|
|
1500
|
+
catch {
|
|
1501
1501
|
// JSON 解析失败时返回空对象
|
|
1502
1502
|
text = {};
|
|
1503
1503
|
}
|
|
@@ -1508,7 +1508,8 @@ class McxUtlis {
|
|
|
1508
1508
|
}
|
|
1509
1509
|
return text;
|
|
1510
1510
|
}
|
|
1511
|
-
catch
|
|
1511
|
+
catch {
|
|
1512
|
+
// err 变量不再使用,直接忽略
|
|
1512
1513
|
// 如果不是最后一次尝试,则等待后重试
|
|
1513
1514
|
if (attempt < opts.maxRetries - 1) {
|
|
1514
1515
|
await McxUtlis.sleep(opts.delay);
|
|
@@ -2026,7 +2027,7 @@ function transformESMToCJS(code, pluginContext, hook) {
|
|
|
2026
2027
|
* 将 import IR 转换为 require 声明
|
|
2027
2028
|
*/
|
|
2028
2029
|
function transformImportIRtoRequire(importIR) {
|
|
2029
|
-
|
|
2030
|
+
const define = [
|
|
2030
2031
|
t__namespace.variableDeclarator(t__namespace.identifier('__import_default'), t__namespace.functionExpression(null, [t__namespace.identifier('obj')], t__namespace.blockStatement([
|
|
2031
2032
|
t__namespace.returnStatement(t__namespace.conditionalExpression(t__namespace.memberExpression(t__namespace.identifier('obj'), t__namespace.identifier('__esModule')), t__namespace.memberExpression(t__namespace.identifier('obj'), t__namespace.identifier('default')), t__namespace.identifier('obj'))),
|
|
2032
2033
|
]))),
|