@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.
@@ -1,86 +1,97 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.annotateError = annotateError;
5
- exports.formatDiagnostic = formatDiagnostic;
6
- function _nodeUrl() {
7
- const data = _interopRequireDefault(require("node:url"));
8
- _nodeUrl = function () {
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 _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
+ function _interop_require_default(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
14
35
  function errorToLoc(filename, error) {
15
- if (typeof error.name === 'string' && typeof error.stack === 'string') {
16
- let stack = error.stack.slice(error.name.length + 2 /* '${name}: ' prefix */);
17
- stack = stack.slice(error.message.length);
18
- const trace = stack.match(/at ([^\n]+):(\d+):(\d+)/m);
19
- if (_nodeUrl().default.pathToFileURL(filename).href === trace?.[1]) {
20
- const line = Number(trace[2]);
21
- return Number.isSafeInteger(line) ? {
22
- line,
23
- column: Number(trace[3]) || undefined
24
- } : null;
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
- if (!diagnostic) {
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
- if (typeof error !== 'object' || error == null) {
64
- return null;
65
- }
66
- if (code) {
67
- const loc = errorToLoc(filename, error);
68
- if (loc) {
69
- const {
70
- codeFrameColumns
71
- } = require('@babel/code-frame');
72
- const codeFrame = codeFrameColumns(code, {
73
- start: loc
74
- }, {
75
- highlightCode: true
76
- });
77
- const annotatedError = error;
78
- annotatedError.codeFrame = codeFrame;
79
- annotatedError.message += `\n${codeFrame}`;
80
- delete annotatedError.stack;
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
- //# sourceMappingURL=codeframe.js.map
96
+
97
+ //# sourceMappingURL=codeframe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeframe.js","names":["_nodeUrl","data","_interopRequireDefault","require","e","__esModule","default","errorToLoc","filename","error","name","stack","slice","length","message","trace","match","url","pathToFileURL","href","line","Number","isSafeInteger","column","undefined","formatDiagnostic","diagnostic","start","file","messageText","codeFrameColumns","character","getLineAndCharacterOfPosition","loc","codeFrame","getText","highlightCode","annotatedError","SyntaxError","annotateError","code"],"sources":["../src/codeframe.ts"],"sourcesContent":["import url from 'node:url';\nimport type { Diagnostic } from 'typescript';\n\nfunction errorToLoc(filename: string, error: Error) {\n if (typeof error.name === 'string' && typeof error.stack === 'string') {\n let stack = error.stack.slice(error.name.length + 2 /* '${name}: ' prefix */);\n stack = stack.slice(error.message.length);\n const trace = stack.match(/at ([^\\n]+):(\\d+):(\\d+)/m);\n if (url.pathToFileURL(filename).href === trace?.[1]) {\n const line = Number(trace[2]);\n return Number.isSafeInteger(line) ? { line, column: Number(trace[3]) || undefined } : null;\n }\n }\n return null;\n}\n\nexport function formatDiagnostic(diagnostic: Diagnostic | undefined) {\n if (!diagnostic) {\n return null;\n }\n const { start, file, messageText } = diagnostic;\n if (file && messageText && start != null) {\n const { codeFrameColumns }: typeof import('@babel/code-frame') = require('@babel/code-frame');\n const { line, character } = file.getLineAndCharacterOfPosition(start);\n const loc = { line: line + 1, column: character + 1 };\n const codeFrame = codeFrameColumns(file.getText(), { start: loc }, { highlightCode: true });\n const annotatedError = new SyntaxError(`${messageText}\\n${codeFrame}`) as SyntaxError & {\n codeFrame: string;\n };\n annotatedError.codeFrame = codeFrame;\n delete annotatedError.stack;\n return annotatedError;\n }\n return null;\n}\n\nexport function annotateError(code: string | null, filename: string, error: Error) {\n if (typeof error !== 'object' || error == null) {\n return null;\n }\n if (code) {\n const loc = errorToLoc(filename, error);\n if (loc) {\n const { codeFrameColumns }: typeof import('@babel/code-frame') = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(code, { start: loc }, { highlightCode: true });\n const annotatedError = error as Error & { codeFrame: string };\n annotatedError.codeFrame = codeFrame;\n annotatedError.message += `\\n${codeFrame}`;\n delete annotatedError.stack;\n return annotatedError;\n }\n }\n return null;\n}\n"],"mappings":";;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG3B,SAASG,UAAUA,CAACC,QAAgB,EAAEC,KAAY,EAAE;EAClD,IAAI,OAAOA,KAAK,CAACC,IAAI,KAAK,QAAQ,IAAI,OAAOD,KAAK,CAACE,KAAK,KAAK,QAAQ,EAAE;IACrE,IAAIA,KAAK,GAAGF,KAAK,CAACE,KAAK,CAACC,KAAK,CAACH,KAAK,CAACC,IAAI,CAACG,MA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C,WAAW,CAAC,GAAGT,WAAW,KAAKK,SAAS,EAAE,CAEpE;IACDG,cAAc,CAACH,SAAS,GAAGA,SAAS;IACpC,OAAOG,cAAc,CAAC1B,KAAK;IAC3B,OAAO0B,cAAc;EACvB;EACA,OAAO,IAAI;AACb;AAEO,SAASE,aAAaA,CAACC,IAAmB,EAAEhC,QAAgB,EAAEC,KAAY,EAAE;EACjF,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,IAAI,IAAI,EAAE;IAC9C,OAAO,IAAI;EACb;EACA,IAAI+B,IAAI,EAAE;IACR,MAAMP,GAAG,GAAG1B,UAAU,CAACC,QAAQ,EAAEC,KAAK,CAAC;IACvC,IAAIwB,GAAG,EAAE;MACP,MAAM;QAAEH;MAAqD,CAAC,GAAG3B,OAAO,CAAC,mBAAmB,CAAC;MAC7F,MAAM+B,SAAS,GAAGJ,gBAAgB,CAACU,IAAI,EAAE;QAAEb,KAAK,EAAEM;MAAI,CAAC,EAAE;QAAEG,aAAa,EAAE;MAAK,CAAC,CAAC;MACjF,MAAMC,cAAc,GAAG5B,KAAsC;MAC7D4B,cAAc,CAACH,SAAS,GAAGA,SAAS;MACpCG,cAAc,CAACvB,OAAO,IAAI,KAAKoB,SAAS,EAAE;MAC1C,OAAOG,cAAc,CAAC1B,KAAK;MAC3B,OAAO0B,cAAc;IACvB;EACF;EACA,OAAO,IAAI;AACb","ignoreList":[]}
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;IA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A,UAAU,YAAYA,SAAS,MAAM;QAC9C,OAAO;IACT;IACA,IAAI8B,MAAM;QACR,MAAMN,MAAM1B,WAAWC,UAAUC;QACjC,IAAIwB,KAAK;YACP,MAAM,EAAEJ,gBAAgB,EAAE,GAAuCC,QAAQ;YACzE,MAAMI,YAAYL,iBAAiBU,MAAM;gBAAEb,OAAOO;YAAI,GAAG;gBAAEG,eAAe;YAAK;YAC/E,MAAMC,iBAAiB5B;YACvB4B,eAAeH,SAAS,GAAGA;YAC3BG,eAAevB,OAAO,IAAI,CAAC,EAAE,EAAEoB,WAAW;YAC1C,OAAOG,eAAe1B,KAAK;YAC3B,OAAO0B;QACT;IACF;IACA,OAAO;AACT"}
package/build/index.js CHANGED
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
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
- var _resolveGlobal = require("./resolveGlobal");
17
- Object.keys(_resolveGlobal).forEach(function (key) {
18
- if (key === "default" || key === "__esModule") return;
19
- if (key in exports && exports[key] === _resolveGlobal[key]) return;
20
- exports[key] = _resolveGlobal[key];
21
- });
22
- //# sourceMappingURL=index.js.map
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_load","require","Object","keys","forEach","key","exports","_resolve","_resolveGlobal"],"sources":["../src/index.ts"],"sourcesContent":["export * from './load';\nexport * from './resolve';\nexport * from './resolveGlobal';\n"],"mappings":";;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,KAAA,CAAAK,GAAA;AAAA;AACA,IAAAE,QAAA,GAAAN,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAI,QAAA,EAAAH,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAE,QAAA,CAAAF,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAE,QAAA,CAAAF,GAAA;AAAA;AACA,IAAAG,cAAA,GAAAP,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAK,cAAA,EAAAJ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAG,cAAA,CAAAH,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAG,cAAA,CAAAH,GAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;qBAAc;qBACA;qBACA"}