Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit 2005462

Browse files
P0lipmarbemac
authored andcommitted
fix: set parentPath and fragment correctly in lookupUri (#63)
* fix: proper parentPath * fix: include fragment
1 parent d6d6361 commit 2005462

File tree

3 files changed

+27
-50
lines changed

3 files changed

+27
-50
lines changed

src/runner.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,12 @@ export class ResolveRunner implements Types.IResolveRunner {
291291
return this.uriStack.length >= 100;
292292
};
293293

294-
public lookupUri = async (opts: { ref: uri.URI; cacheKey: string }): Promise<ResolveRunner> => {
294+
public lookupUri = async (opts: {
295+
fragment: string;
296+
ref: uri.URI;
297+
cacheKey: string;
298+
parentPath: string[];
299+
}): Promise<ResolveRunner> => {
295300
const { ref } = opts;
296301

297302
let scheme = ref.scheme();
@@ -317,7 +322,8 @@ export class ResolveRunner implements Types.IResolveRunner {
317322
result,
318323
targetAuthority: ref,
319324
parentAuthority: this.baseUri,
320-
parentPath: [],
325+
parentPath: opts.parentPath,
326+
fragment: opts.fragment,
321327
});
322328

323329
result = parsed.result;
@@ -377,7 +383,9 @@ export class ResolveRunner implements Types.IResolveRunner {
377383

378384
uriResolver = await this.lookupUri({
379385
ref: ref.clone().fragment(''),
386+
fragment: ref.fragment(),
380387
cacheKey: uriCacheKey,
388+
parentPath,
381389
});
382390

383391
const currentAuthority = this.baseUri.toString();

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export interface IResolver {
114114

115115
export interface IUriParser {
116116
result: any;
117+
fragment: string;
117118
uriResult: IUriResult;
118119
targetAuthority: uri.URI;
119120
parentAuthority: uri.URI;

yarn.lock

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
21542154
dependencies:
21552155
ms "^2.1.1"
21562156

2157-
debuglog@*, debuglog@^1.0.1:
2157+
debuglog@^1.0.1:
21582158
version "1.0.1"
21592159
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
21602160
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@@ -3365,7 +3365,7 @@ import-local@^2.0.0:
33653365
pkg-dir "^3.0.0"
33663366
resolve-cwd "^2.0.0"
33673367

3368-
imurmurhash@*, imurmurhash@^0.1.4:
3368+
imurmurhash@^0.1.4:
33693369
version "0.1.4"
33703370
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
33713371
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@@ -4500,7 +4500,7 @@ libnpm@^2.0.1:
45004500
read-package-json "^2.0.13"
45014501
stringify-package "^1.0.0"
45024502

4503-
libnpmaccess@*, libnpmaccess@^3.0.1:
4503+
libnpmaccess@^3.0.1:
45044504
version "3.0.1"
45054505
resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-3.0.1.tgz#5b3a9de621f293d425191aa2e779102f84167fa8"
45064506
integrity sha512-RlZ7PNarCBt+XbnP7R6PoVgOq9t+kou5rvhaInoNibhPO7eMlRfS0B8yjatgn2yaHIwWNyoJDolC/6Lc5L/IQA==
@@ -4537,7 +4537,7 @@ libnpmhook@^5.0.2:
45374537
get-stream "^4.0.0"
45384538
npm-registry-fetch "^3.8.0"
45394539

4540-
libnpmorg@*, libnpmorg@^1.0.0:
4540+
libnpmorg@^1.0.0:
45414541
version "1.0.0"
45424542
resolved "https://registry.yarnpkg.com/libnpmorg/-/libnpmorg-1.0.0.tgz#979b868c48ba28c5820e3bb9d9e73c883c16a232"
45434543
integrity sha512-o+4eVJBoDGMgRwh2lJY0a8pRV2c/tQM/SxlqXezjcAg26Qe9jigYVs+Xk0vvlYDWCDhP0g74J8UwWeAgsB7gGw==
@@ -4562,7 +4562,7 @@ libnpmpublish@^1.1.0:
45624562
semver "^5.5.1"
45634563
ssri "^6.0.1"
45644564

4565-
libnpmsearch@*, libnpmsearch@^2.0.0:
4565+
libnpmsearch@^2.0.0:
45664566
version "2.0.1"
45674567
resolved "https://registry.yarnpkg.com/libnpmsearch/-/libnpmsearch-2.0.1.tgz#eccc73a8fbf267d765d18082b85daa2512501f96"
45684568
integrity sha512-K0yXyut9MHHCAH+DOiglQCpmBKPZXSUu76+BE2maSEfQN15OwNaA/Aiioe9lRFlVFOr7WcuJCY+VSl+gLi9NTA==
@@ -4571,7 +4571,7 @@ libnpmsearch@*, libnpmsearch@^2.0.0:
45714571
get-stream "^4.0.0"
45724572
npm-registry-fetch "^3.8.0"
45734573

4574-
libnpmteam@*, libnpmteam@^1.0.1:
4574+
libnpmteam@^1.0.1:
45754575
version "1.0.1"
45764576
resolved "https://registry.yarnpkg.com/libnpmteam/-/libnpmteam-1.0.1.tgz#ff704b1b6c06ea674b3b1101ac3e305f5114f213"
45774577
integrity sha512-gDdrflKFCX7TNwOMX1snWojCoDE5LoRWcfOC0C/fqF7mBq8Uz9zWAX4B2RllYETNO7pBupBaSyBDkTAC15cAMg==
@@ -4716,11 +4716,6 @@ lockfile@^1.0.4:
47164716
dependencies:
47174717
signal-exit "^3.0.2"
47184718

4719-
lodash._baseindexof@*:
4720-
version "3.1.0"
4721-
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
4722-
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
4723-
47244719
lodash._baseuniq@~4.6.0:
47254720
version "4.6.0"
47264721
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@@ -4729,33 +4724,11 @@ lodash._baseuniq@~4.6.0:
47294724
lodash._createset "~4.0.0"
47304725
lodash._root "~3.0.0"
47314726

4732-
lodash._bindcallback@*:
4733-
version "3.0.1"
4734-
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
4735-
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
4736-
4737-
lodash._cacheindexof@*:
4738-
version "3.0.2"
4739-
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
4740-
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
4741-
4742-
lodash._createcache@*:
4743-
version "3.1.2"
4744-
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
4745-
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
4746-
dependencies:
4747-
lodash._getnative "^3.0.0"
4748-
47494727
lodash._createset@~4.0.0:
47504728
version "4.0.3"
47514729
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
47524730
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
47534731

4754-
lodash._getnative@*, lodash._getnative@^3.0.0:
4755-
version "3.9.1"
4756-
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
4757-
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
4758-
47594732
lodash._reinterpolate@~3.0.0:
47604733
version "3.0.0"
47614734
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -4801,11 +4774,6 @@ lodash.map@^4.5.1:
48014774
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
48024775
integrity sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=
48034776

4804-
lodash.restparam@*:
4805-
version "3.6.1"
4806-
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
4807-
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
4808-
48094777
lodash.set@^4.3.2:
48104778
version "4.3.2"
48114779
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@@ -5565,15 +5533,6 @@ npm-pick-manifest@^2.1.0, npm-pick-manifest@^2.2.3:
55655533
npm-package-arg "^6.0.0"
55665534
semver "^5.4.1"
55675535

5568-
npm-profile@*, npm-profile@^4.0.1:
5569-
version "4.0.1"
5570-
resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-4.0.1.tgz#d350f7a5e6b60691c7168fbb8392c3603583f5aa"
5571-
integrity sha512-NQ1I/1Q7YRtHZXkcuU1/IyHeLy6pd+ScKg4+DQHdfsm769TGq6HPrkbuNJVJS4zwE+0mvvmeULzQdWn2L2EsVA==
5572-
dependencies:
5573-
aproba "^1.1.2 || 2"
5574-
figgy-pudding "^3.4.1"
5575-
npm-registry-fetch "^3.8.0"
5576-
55775536
npm-profile@^3.0.2:
55785537
version "3.0.2"
55795538
resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-3.0.2.tgz#58d568f1b56ef769602fd0aed8c43fa0e0de0f57"
@@ -5582,6 +5541,15 @@ npm-profile@^3.0.2:
55825541
aproba "^1.1.2 || 2"
55835542
make-fetch-happen "^2.5.0 || 3 || 4"
55845543

5544+
npm-profile@^4.0.1:
5545+
version "4.0.1"
5546+
resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-4.0.1.tgz#d350f7a5e6b60691c7168fbb8392c3603583f5aa"
5547+
integrity sha512-NQ1I/1Q7YRtHZXkcuU1/IyHeLy6pd+ScKg4+DQHdfsm769TGq6HPrkbuNJVJS4zwE+0mvvmeULzQdWn2L2EsVA==
5548+
dependencies:
5549+
aproba "^1.1.2 || 2"
5550+
figgy-pudding "^3.4.1"
5551+
npm-registry-fetch "^3.8.0"
5552+
55855553
npm-registry-client@^8.6.0:
55865554
version "8.6.0"
55875555
resolved "https://registry.yarnpkg.com/npm-registry-client/-/npm-registry-client-8.6.0.tgz#7f1529f91450732e89f8518e0f21459deea3e4c4"
@@ -6678,7 +6646,7 @@ readable-stream@~1.1.10:
66786646
isarray "0.0.1"
66796647
string_decoder "~0.10.x"
66806648

6681-
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
6649+
readdir-scoped-modules@^1.0.0:
66826650
version "1.0.2"
66836651
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
66846652
integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=

0 commit comments

Comments
 (0)