@expo/require-utils 57.0.4 → 58.0.0-canary-20260806-8c2d007
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/build/codeframe.js +85 -74
- package/build/codeframe.js.map +1 -1
- package/build/index.js +21 -20
- package/build/index.js.map +1 -1
- package/build/load.js +402 -352
- package/build/load.js.map +1 -1
- package/build/resolve.js +152 -151
- package/build/resolve.js.map +1 -1
- package/build/resolveGlobal.d.ts +1 -3
- package/build/resolveGlobal.js +168 -136
- package/build/resolveGlobal.js.map +1 -1
- package/build/stacktrace.js +246 -230
- package/build/stacktrace.js.map +1 -1
- package/build/transform.js +36 -24
- package/build/transform.js.map +1 -1
- package/package.json +37 -25
package/build/codeframe.js
CHANGED
|
@@ -1,86 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
annotateError: null,
|
|
7
|
+
formatDiagnostic: null
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
get annotateError () {
|
|
17
|
+
return annotateError;
|
|
18
|
+
},
|
|
19
|
+
get formatDiagnostic () {
|
|
20
|
+
return formatDiagnostic;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function _nodeurl() {
|
|
24
|
+
const data = /*#__PURE__*/ _interop_require_default(require("node:url"));
|
|
25
|
+
_nodeurl = function() {
|
|
26
|
+
return data;
|
|
27
|
+
};
|
|
9
28
|
return data;
|
|
10
|
-
};
|
|
11
|
-
return data;
|
|
12
29
|
}
|
|
13
|
-
function
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
14
35
|
function errorToLoc(filename, error) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
36
|
+
if (typeof error.name === 'string' && typeof error.stack === 'string') {
|
|
37
|
+
let stack = error.stack.slice(error.name.length + 2 /* '${name}: ' prefix */ );
|
|
38
|
+
stack = stack.slice(error.message.length);
|
|
39
|
+
const trace = stack.match(/at ([^\n]+):(\d+):(\d+)/m);
|
|
40
|
+
if (_nodeurl().default.pathToFileURL(filename).href === trace?.[1]) {
|
|
41
|
+
const line = Number(trace[2]);
|
|
42
|
+
return Number.isSafeInteger(line) ? {
|
|
43
|
+
line,
|
|
44
|
+
column: Number(trace[3]) || undefined
|
|
45
|
+
} : null;
|
|
46
|
+
}
|
|
25
47
|
}
|
|
26
|
-
|
|
27
|
-
return null;
|
|
48
|
+
return null;
|
|
28
49
|
}
|
|
29
50
|
function formatDiagnostic(diagnostic) {
|
|
30
|
-
|
|
51
|
+
if (!diagnostic) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const { start, file, messageText } = diagnostic;
|
|
55
|
+
if (file && messageText && start != null) {
|
|
56
|
+
const { codeFrameColumns } = require('@babel/code-frame');
|
|
57
|
+
const { line, character } = file.getLineAndCharacterOfPosition(start);
|
|
58
|
+
const loc = {
|
|
59
|
+
line: line + 1,
|
|
60
|
+
column: character + 1
|
|
61
|
+
};
|
|
62
|
+
const codeFrame = codeFrameColumns(file.getText(), {
|
|
63
|
+
start: loc
|
|
64
|
+
}, {
|
|
65
|
+
highlightCode: true
|
|
66
|
+
});
|
|
67
|
+
const annotatedError = new SyntaxError(`${messageText}\n${codeFrame}`);
|
|
68
|
+
annotatedError.codeFrame = codeFrame;
|
|
69
|
+
delete annotatedError.stack;
|
|
70
|
+
return annotatedError;
|
|
71
|
+
}
|
|
31
72
|
return null;
|
|
32
|
-
}
|
|
33
|
-
const {
|
|
34
|
-
start,
|
|
35
|
-
file,
|
|
36
|
-
messageText
|
|
37
|
-
} = diagnostic;
|
|
38
|
-
if (file && messageText && start != null) {
|
|
39
|
-
const {
|
|
40
|
-
codeFrameColumns
|
|
41
|
-
} = require('@babel/code-frame');
|
|
42
|
-
const {
|
|
43
|
-
line,
|
|
44
|
-
character
|
|
45
|
-
} = file.getLineAndCharacterOfPosition(start);
|
|
46
|
-
const loc = {
|
|
47
|
-
line: line + 1,
|
|
48
|
-
column: character + 1
|
|
49
|
-
};
|
|
50
|
-
const codeFrame = codeFrameColumns(file.getText(), {
|
|
51
|
-
start: loc
|
|
52
|
-
}, {
|
|
53
|
-
highlightCode: true
|
|
54
|
-
});
|
|
55
|
-
const annotatedError = new SyntaxError(`${messageText}\n${codeFrame}`);
|
|
56
|
-
annotatedError.codeFrame = codeFrame;
|
|
57
|
-
delete annotatedError.stack;
|
|
58
|
-
return annotatedError;
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
73
|
}
|
|
62
74
|
function annotateError(code, filename, error) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return annotatedError;
|
|
75
|
+
if (typeof error !== 'object' || error == null) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
if (code) {
|
|
79
|
+
const loc = errorToLoc(filename, error);
|
|
80
|
+
if (loc) {
|
|
81
|
+
const { codeFrameColumns } = require('@babel/code-frame');
|
|
82
|
+
const codeFrame = codeFrameColumns(code, {
|
|
83
|
+
start: loc
|
|
84
|
+
}, {
|
|
85
|
+
highlightCode: true
|
|
86
|
+
});
|
|
87
|
+
const annotatedError = error;
|
|
88
|
+
annotatedError.codeFrame = codeFrame;
|
|
89
|
+
annotatedError.message += `\n${codeFrame}`;
|
|
90
|
+
delete annotatedError.stack;
|
|
91
|
+
return annotatedError;
|
|
92
|
+
}
|
|
82
93
|
}
|
|
83
|
-
|
|
84
|
-
return null;
|
|
94
|
+
return null;
|
|
85
95
|
}
|
|
86
|
-
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=codeframe.js.map
|
package/build/codeframe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["codeframe.ts"],"sourcesContent":[null],"names":["annotateError","formatDiagnostic","errorToLoc","filename","error","name","stack","slice","length","message","trace","match","url","pathToFileURL","href","line","Number","isSafeInteger","column","undefined","diagnostic","start","file","messageText","codeFrameColumns","require","character","getLineAndCharacterOfPosition","loc","codeFrame","getText","highlightCode","annotatedError","SyntaxError","code"],"mappings":";;;;;;;;;;;;;;;QAoCgBA;eAAAA;;QApBAC;eAAAA;;;;gEAhBA;;;;;;;;;;;AAGhB,SAASC,WAAWC,QAAgB,EAAEC,KAAY;IAChD,IAAI,OAAOA,MAAMC,IAAI,KAAK,YAAY,OAAOD,MAAME,KAAK,KAAK,UAAU;QACrE,IAAIA,QAAQF,MAAME,KAAK,CAACC,KAAK,CAACH,MAAMC,IAAI,CAACG,MAAM,GAAG,EAAE,sBAAsB;QAC1EF,QAAQA,MAAMC,KAAK,CAACH,MAAMK,OAAO,CAACD,MAAM;QACxC,MAAME,QAAQJ,MAAMK,KAAK,CAAC;QAC1B,IAAIC,kBAAG,CAACC,aAAa,CAACV,UAAUW,IAAI,KAAKJ,OAAO,CAAC,EAAE,EAAE;YACnD,MAAMK,OAAOC,OAAON,KAAK,CAAC,EAAE;YAC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0B;QACT;IACF;IACA,OAAO;AACT"}
|
package/build/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _load = require("./load");
|
|
5
|
-
Object.keys(_load).forEach(function (key) {
|
|
6
|
-
if (key === "default" || key === "__esModule") return;
|
|
7
|
-
if (key in exports && exports[key] === _load[key]) return;
|
|
8
|
-
exports[key] = _load[key];
|
|
9
|
-
});
|
|
10
|
-
var _resolve = require("./resolve");
|
|
11
|
-
Object.keys(_resolve).forEach(function (key) {
|
|
12
|
-
if (key === "default" || key === "__esModule") return;
|
|
13
|
-
if (key in exports && exports[key] === _resolve[key]) return;
|
|
14
|
-
exports[key] = _resolve[key];
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
15
4
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
0 && __export(require("./load")) && __export(require("./resolve")) && __export(require("./resolveGlobal"));
|
|
6
|
+
_export_star(require("./load"), exports);
|
|
7
|
+
_export_star(require("./resolve"), exports);
|
|
8
|
+
_export_star(require("./resolveGlobal"), exports);
|
|
9
|
+
function _export_star(from, to) {
|
|
10
|
+
Object.keys(from).forEach(function(k) {
|
|
11
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
12
|
+
Object.defineProperty(to, k, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return from[k];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return from;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;qBAAc;qBACA;qBACA"}
|