@vxrn/resolve 1.1.338 → 1.1.339

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,7 +1,9 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all) __defProp(target, name, {
7
9
  get: all[name],
@@ -15,15 +17,34 @@ var __export = (target, all) => {
15
17
  });
16
18
  return to;
17
19
  };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
21
32
  var src_exports = {};
22
33
  __export(src_exports, {
23
34
  resolvePath: () => resolvePath
24
35
  });
25
36
  module.exports = __toCommonJS(src_exports);
26
- var import_node_url = require("node:url");
37
+ var import_node_module = __toESM(require("node:module"), 1),
38
+ import_node_url = require("node:url");
27
39
  const import_meta = {},
28
40
  resolver = "resolve" in import_meta ? (path, from) => (0, import_node_url.fileURLToPath)(import_meta.resolve(path, from)) : "url" in import_meta ? (path, from) => new URL(path, import_meta.url).pathname : require.resolve,
29
- resolvePath = (path, from) => resolver(path, from);
41
+ resolverV2 = (path, from) => import_node_module.default.createRequire(from).resolve(path, {
42
+ paths: [from]
43
+ }),
44
+ resolvePath = (path, from) => {
45
+ try {
46
+ return resolver(path, from);
47
+ } catch {
48
+ return resolverV2(path, from);
49
+ }
50
+ };
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __export = (target, all) => {
6
7
  for (var name in all)
7
8
  __defProp(target, name, { get: all[name], enumerable: !0 });
@@ -11,12 +12,25 @@ var __export = (target, all) => {
11
12
  !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
13
  return to;
13
14
  };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
23
  var src_exports = {};
16
24
  __export(src_exports, {
17
25
  resolvePath: () => resolvePath
18
26
  });
19
27
  module.exports = __toCommonJS(src_exports);
20
- var import_node_url = require("node:url");
21
- const import_meta = {}, resolver = "resolve" in import_meta ? (path, from) => (0, import_node_url.fileURLToPath)(import_meta.resolve(path, from)) : "url" in import_meta ? (path, from) => new URL(path, import_meta.url).pathname : require.resolve, resolvePath = (path, from) => resolver(path, from);
28
+ var import_node_module = __toESM(require("node:module"), 1), import_node_url = require("node:url");
29
+ const import_meta = {}, resolver = "resolve" in import_meta ? (path, from) => (0, import_node_url.fileURLToPath)(import_meta.resolve(path, from)) : "url" in import_meta ? (path, from) => new URL(path, import_meta.url).pathname : require.resolve, resolverV2 = (path, from) => import_node_module.default.createRequire(from).resolve(path, { paths: [from] }), resolvePath = (path, from) => {
30
+ try {
31
+ return resolver(path, from);
32
+ } catch {
33
+ return resolverV2(path, from);
34
+ }
35
+ };
22
36
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AAA9B,wBAEM,WACJ,aAAa,cACT,CAAC,MAAc,aAAkB,+BAAc,YAAY,QAAQ,MAAM,IAAI,CAAC,IAC9E,SAAS,cACP,CAAC,MAAc,SAAkB,IAAI,IAAI,MAAM,YAAY,GAAG,EAAE,WAChE,QAAQ,SAEH,cAAc,CAAC,MAAc,SACjC,SAAS,MAAM,IAAI;",
5
- "names": []
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAmB,oCACnB,kBAA8B;AAD9B,wBAGM,WACJ,aAAa,cACT,CAAC,MAAc,aAAkB,+BAAc,YAAY,QAAQ,MAAM,IAAI,CAAC,IAC9E,SAAS,cACP,CAAC,MAAc,SAAkB,IAAI,IAAI,MAAM,YAAY,GAAG,EAAE,WAChE,QAAQ,SAEV,aAAa,CAAC,MAAM,SACR,mBAAAA,QAAO,cAAc,IAAI,EACd,QAAQ,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,GAI/C,cAAc,CAAC,MAAc,SAA0B;AAElE,MAAI;AACF,WAAO,SAAS,MAAM,IAAI;AAAA,EAC5B,QAAY;AACV,WAAO,WAAW,MAAM,IAAI;AAAA,EAC9B;AACF;",
5
+ "names": ["module"]
6
6
  }
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: !0 });
@@ -12,20 +13,38 @@ var __export = (target, all) => {
12
13
  !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
14
  return to;
14
15
  };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
+ mod
23
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
24
  var src_exports = {};
17
25
  __export(src_exports, {
18
26
  resolvePath: () => resolvePath
19
27
  });
20
28
  module.exports = __toCommonJS(src_exports);
21
- var import_node_url = require("node:url");
29
+ var import_node_module = __toESM(require("node:module"), 1), import_node_url = require("node:url");
22
30
  const import_meta = {};
23
31
  var resolver = "resolve" in import_meta ? function(path, from) {
24
32
  return (0, import_node_url.fileURLToPath)(import_meta.resolve(path, from));
25
33
  } : "url" in import_meta ? function(path, from) {
26
34
  return new URL(path, import_meta.url).pathname;
27
- } : require.resolve, resolvePath = function(path, from) {
28
- return resolver(path, from);
35
+ } : require.resolve, resolverV2 = function(path, from) {
36
+ var _$require = import_node_module.default.createRequire(from), importPath = _$require.resolve(path, {
37
+ paths: [
38
+ from
39
+ ]
40
+ });
41
+ return importPath;
42
+ }, resolvePath = function(path, from) {
43
+ try {
44
+ return resolver(path, from);
45
+ } catch {
46
+ return resolverV2(path, from);
47
+ }
29
48
  };
30
49
  // Annotate the CommonJS export names for ESM import in node:
31
50
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/one/packages/resolve/src/index.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;sBAA8B;AAA9B;AAEA,IAAMA,WACJ,aAAa,cACT,SAACC,MAAcC,MAAAA;aAAkBC,+BAAc,YAAYC,QAAQH,MAAMC,IAAAA,CAAAA;IACzE,SAAS,cACP,SAACD,MAAcC,MAAAA;SAAkB,IAAIG,IAAIJ,MAAM,YAAYK,GAAG,EAAEC;IAChEC,QAAQJ,SAEHK,cAAc,SAACR,MAAcC,MAAAA;AACxC,SAAOF,SAASC,MAAMC,IAAAA;AACxB;",
5
- "names": ["resolver", "path", "from", "fileURLToPath", "resolve", "URL", "url", "pathname", "require", "resolvePath"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;yBAAmB,oCACnB,kBAA8B;AAD9B;AAGA,IAAMA,WACJ,aAAa,cACT,SAACC,MAAcC,MAAAA;aAAkBC,+BAAc,YAAYC,QAAQH,MAAMC,IAAAA,CAAAA;IACzE,SAAS,cACP,SAACD,MAAcC,MAAAA;SAAkB,IAAIG,IAAIJ,MAAM,YAAYK,GAAG,EAAEC;IAChEC,QAAQJ,SAEVK,aAAa,SAACR,MAAMC,MAAAA;AACxB,MAAMM,YAAUE,mBAAAA,QAAOC,cAAcT,IAAAA,GAC/BU,aAAaJ,UAAQJ,QAAQH,MAAM;IAAEY,OAAO;MAACX;;EAAM,CAAA;AACzD,SAAOU;AACT,GAEaE,cAAc,SAACb,MAAcC,MAAAA;AAExC,MAAI;AACF,WAAOF,SAASC,MAAMC,IAAAA;EACxB,QAAY;AACV,WAAOO,WAAWR,MAAMC,IAAAA;EAC1B;AACF;",
5
+ "names": ["resolver", "path", "from", "fileURLToPath", "resolve", "URL", "url", "pathname", "require", "resolverV2", "module", "createRequire", "importPath", "paths", "resolvePath"]
6
6
  }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,12 @@
1
+ import module from "node:module";
1
2
  import { fileURLToPath } from "node:url";
2
- const resolver = "resolve" in import.meta ? (path, from) => fileURLToPath(import.meta.resolve(path, from)) : "url" in import.meta ? (path, from) => new URL(path, import.meta.url).pathname : require.resolve, resolvePath = (path, from) => resolver(path, from);
3
+ const resolver = "resolve" in import.meta ? (path, from) => fileURLToPath(import.meta.resolve(path, from)) : "url" in import.meta ? (path, from) => new URL(path, import.meta.url).pathname : require.resolve, resolverV2 = (path, from) => module.createRequire(from).resolve(path, { paths: [from] }), resolvePath = (path, from) => {
4
+ try {
5
+ return resolver(path, from);
6
+ } catch {
7
+ return resolverV2(path, from);
8
+ }
9
+ };
3
10
  export {
4
11
  resolvePath
5
12
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
- "mappings": "AAAA,SAAS,qBAAqB;AAE9B,MAAM,WACJ,aAAa,cACT,CAAC,MAAc,SAAkB,cAAc,YAAY,QAAQ,MAAM,IAAI,CAAC,IAC9E,SAAS,cACP,CAAC,MAAc,SAAkB,IAAI,IAAI,MAAM,YAAY,GAAG,EAAE,WAChE,QAAQ,SAEH,cAAc,CAAC,MAAc,SACjC,SAAS,MAAM,IAAI;",
4
+ "mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,qBAAqB;AAE9B,MAAM,WACJ,aAAa,cACT,CAAC,MAAc,SAAkB,cAAc,YAAY,QAAQ,MAAM,IAAI,CAAC,IAC9E,SAAS,cACP,CAAC,MAAc,SAAkB,IAAI,IAAI,MAAM,YAAY,GAAG,EAAE,WAChE,QAAQ,SAEV,aAAa,CAAC,MAAM,SACR,OAAO,cAAc,IAAI,EACd,QAAQ,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,GAI/C,cAAc,CAAC,MAAc,SAA0B;AAElE,MAAI;AACF,WAAO,SAAS,MAAM,IAAI;AAAA,EAC5B,QAAY;AACV,WAAO,WAAW,MAAM,IAAI;AAAA,EAC9B;AACF;",
5
5
  "names": []
6
6
  }
@@ -1,5 +1,15 @@
1
+ import module from "node:module";
1
2
  import { fileURLToPath } from "node:url";
2
3
  const resolver = "resolve" in import.meta ? (path, from) => fileURLToPath(import.meta.resolve(path, from)) : "url" in import.meta ? (path, from) => new URL(path, import.meta.url).pathname : require.resolve,
3
- resolvePath = (path, from) => resolver(path, from);
4
+ resolverV2 = (path, from) => module.createRequire(from).resolve(path, {
5
+ paths: [from]
6
+ }),
7
+ resolvePath = (path, from) => {
8
+ try {
9
+ return resolver(path, from);
10
+ } catch {
11
+ return resolverV2(path, from);
12
+ }
13
+ };
4
14
  export { resolvePath };
5
15
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["fileURLToPath","resolver","import","meta","path","from","resolve","URL","url","pathname","require","resolvePath"],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,QAAqB;AAE9B,MAAMC,QAAA,GACJ,aAAaC,MAAA,CAAAC,IAAA,GACT,CAACC,IAAA,EAAcC,IAAA,KAAkBL,aAAA,CAAcE,MAAA,CAAAC,IAAA,CAAYG,OAAA,CAAQF,IAAA,EAAMC,IAAI,CAAC,IAC9E,SAASH,MAAA,CAAAC,IAAA,GACP,CAACC,IAAA,EAAcC,IAAA,KAAkB,IAAIE,GAAA,CAAIH,IAAA,EAAMF,MAAA,CAAAC,IAAA,CAAYK,GAAG,EAAEC,QAAA,GAChEC,OAAA,CAAQJ,OAAA;EAEHK,WAAA,GAAcA,CAACP,IAAA,EAAcC,IAAA,KACjCJ,QAAA,CAASG,IAAA,EAAMC,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["module","fileURLToPath","resolver","import","meta","path","from","resolve","URL","url","pathname","require","resolverV2","createRequire","paths","resolvePath"],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,MAAA,MAAY;AACnB,SAASC,aAAA,QAAqB;AAE9B,MAAMC,QAAA,GACJ,aAAaC,MAAA,CAAAC,IAAA,GACT,CAACC,IAAA,EAAcC,IAAA,KAAkBL,aAAA,CAAcE,MAAA,CAAAC,IAAA,CAAYG,OAAA,CAAQF,IAAA,EAAMC,IAAI,CAAC,IAC9E,SAASH,MAAA,CAAAC,IAAA,GACP,CAACC,IAAA,EAAcC,IAAA,KAAkB,IAAIE,GAAA,CAAIH,IAAA,EAAMF,MAAA,CAAAC,IAAA,CAAYK,GAAG,EAAEC,QAAA,GAChEC,OAAA,CAAQJ,OAAA;EAEVK,UAAA,GAAaA,CAACP,IAAA,EAAMC,IAAA,KACRN,MAAA,CAAOa,aAAA,CAAcP,IAAI,EACdC,OAAA,CAAQF,IAAA,EAAM;IAAES,KAAA,EAAO,CAACR,IAAI;EAAE,CAAC;EAI/CS,WAAA,GAAcA,CAACV,IAAA,EAAcC,IAAA,KAA0B;IAElE,IAAI;MACF,OAAOJ,QAAA,CAASG,IAAA,EAAMC,IAAI;IAC5B,QAAY;MACV,OAAOM,UAAA,CAAWP,IAAA,EAAMC,IAAI;IAC9B;EACF","ignoreList":[]}
@@ -1,10 +1,22 @@
1
+ import module from "node:module";
1
2
  import { fileURLToPath } from "node:url";
2
3
  var resolver = "resolve" in import.meta ? function(path, from) {
3
4
  return fileURLToPath(import.meta.resolve(path, from));
4
5
  } : "url" in import.meta ? function(path, from) {
5
6
  return new URL(path, import.meta.url).pathname;
6
- } : require.resolve, resolvePath = function(path, from) {
7
- return resolver(path, from);
7
+ } : require.resolve, resolverV2 = function(path, from) {
8
+ var _$require = module.createRequire(from), importPath = _$require.resolve(path, {
9
+ paths: [
10
+ from
11
+ ]
12
+ });
13
+ return importPath;
14
+ }, resolvePath = function(path, from) {
15
+ try {
16
+ return resolver(path, from);
17
+ } catch {
18
+ return resolverV2(path, from);
19
+ }
8
20
  };
9
21
  export {
10
22
  resolvePath
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/one/packages/resolve/src/index.tsx"],
4
- "mappings": "AAAA,SAASA,qBAAqB;AAE9B,IAAMC,WACJ,aAAa,cACT,SAACC,MAAcC,MAAAA;SAAkBH,cAAc,YAAYI,QAAQF,MAAMC,IAAAA,CAAAA;IACzE,SAAS,cACP,SAACD,MAAcC,MAAAA;SAAkB,IAAIE,IAAIH,MAAM,YAAYI,GAAG,EAAEC;IAChEC,QAAQJ,SAEHK,cAAc,SAACP,MAAcC,MAAAA;AACxC,SAAOF,SAASC,MAAMC,IAAAA;AACxB;",
5
- "names": ["fileURLToPath", "resolver", "path", "from", "resolve", "URL", "url", "pathname", "require", "resolvePath"]
4
+ "mappings": "AAAA,OAAOA,YAAY;AACnB,SAASC,qBAAqB;AAE9B,IAAMC,WACJ,aAAa,cACT,SAACC,MAAcC,MAAAA;SAAkBH,cAAc,YAAYI,QAAQF,MAAMC,IAAAA,CAAAA;IACzE,SAAS,cACP,SAACD,MAAcC,MAAAA;SAAkB,IAAIE,IAAIH,MAAM,YAAYI,GAAG,EAAEC;IAChEC,QAAQJ,SAEVK,aAAa,SAACP,MAAMC,MAAAA;AACxB,MAAMK,YAAUT,OAAOW,cAAcP,IAAAA,GAC/BQ,aAAaH,UAAQJ,QAAQF,MAAM;IAAEU,OAAO;MAACT;;EAAM,CAAA;AACzD,SAAOQ;AACT,GAEaE,cAAc,SAACX,MAAcC,MAAAA;AAExC,MAAI;AACF,WAAOF,SAASC,MAAMC,IAAAA;EACxB,QAAY;AACV,WAAOM,WAAWP,MAAMC,IAAAA;EAC1B;AACF;",
5
+ "names": ["module", "fileURLToPath", "resolver", "path", "from", "resolve", "URL", "url", "pathname", "require", "resolverV2", "createRequire", "importPath", "paths", "resolvePath"]
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxrn/resolve",
3
- "version": "1.1.338",
3
+ "version": "1.1.339",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "type": "module",
package/src/index.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import module from 'node:module'
1
2
  import { fileURLToPath } from 'node:url'
2
3
 
3
4
  const resolver =
@@ -7,6 +8,17 @@ const resolver =
7
8
  ? (path: string, from?: string) => new URL(path, import.meta.url).pathname
8
9
  : require.resolve
9
10
 
11
+ const resolverV2 = (path, from) => {
12
+ const require = module.createRequire(from)
13
+ const importPath = require.resolve(path, { paths: [from] })
14
+ return importPath
15
+ }
16
+
10
17
  export const resolvePath = (path: string, from?: string): string => {
11
- return resolver(path, from)
18
+ // We might be able to use resolverV2 directly, but here we'll still try to use the original implementation first in case there're any issues with the new one.
19
+ try {
20
+ return resolver(path, from)
21
+ } catch (e) {
22
+ return resolverV2(path, from)
23
+ }
12
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,MAAM,KAAG,MAEzD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,MAAM,KAAG,MAOzD,CAAA"}