@verdaccio/url 11.0.0-6-next.9 → 11.0.0-6-next.10
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/CHANGELOG.md +33 -0
- package/build/index.d.ts +1 -0
- package/build/index.js.map +1 -1
- package/package.json +59 -58
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.0.0-6-next.10
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 292c0a37: feat!: replace deprecated request dependency by got
|
|
8
|
+
|
|
9
|
+
This is a big refactoring of the core, fetching dependencies, improve code, more tests and better stability. This is essential for the next release, will take some time but would allow modularize more the core.
|
|
10
|
+
|
|
11
|
+
## Notes
|
|
12
|
+
|
|
13
|
+
- Remove deprecated `request` by other `got`, retry improved, custom Agent ( got does not include it built-in)
|
|
14
|
+
- Remove `async` dependency from storage (used by core) it was linked with proxy somehow safe to remove now
|
|
15
|
+
- Refactor with promises instead callback wherever is possible
|
|
16
|
+
- ~Document the API~
|
|
17
|
+
- Improve testing, integration tests
|
|
18
|
+
- Bugfix
|
|
19
|
+
- Clean up old validations
|
|
20
|
+
- Improve performance
|
|
21
|
+
|
|
22
|
+
## 💥 Breaking changes
|
|
23
|
+
|
|
24
|
+
- Plugin API methods were callbacks based are returning promises, this will break current storage plugins, check documentation for upgrade.
|
|
25
|
+
- Write Tarball, Read Tarball methods parameters change, a new set of options like `AbortController` signals are being provided to the `addAbortSignal` can be internally used with Streams when a request is aborted. eg: `addAbortSignal(signal, fs.createReadStream(pathName));`
|
|
26
|
+
- `@verdaccio/streams` stream abort support is legacy is being deprecated removed
|
|
27
|
+
- Remove AWS and Google Cloud packages for future refactoring [#2574](https://github.com/verdaccio/verdaccio/pull/2574).
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [292c0a37]
|
|
32
|
+
- Updated dependencies [a3a209b5]
|
|
33
|
+
- Updated dependencies [00d1d2a1]
|
|
34
|
+
- @verdaccio/core@6.0.0-6-next.6
|
|
35
|
+
|
|
3
36
|
## 11.0.0-6-next.9
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/build/index.d.ts
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["debug","buildDebug","validProtocols","isURLhasValidProtocol","uri","test","isHost","url","options","isURLValidator","require_host","allow_trailing_dot","require_valid_protocol","require_port","require_tld","getWebProtocol","headerProtocol","protocol","returnProtocol","defaultProtocol","commaIndex","indexOf","slice","includes","wrapPrefix","prefix","startsWith","endsWith","combineBaseUrl","host","newPrefix","groupedURI","URL","result","href","validateURL","publicUrl","parsed","replace","Error","err","getPublicUrl","url_prefix","requestOptions","process","env","VERDACCIO_PUBLIC_URL","envURL","headers","protoHeader","VERDACCIO_FORWARDED_PROTO","toLocaleLowerCase","HEADERS","FORWARDED_PROTO","toLowerCase","combinedUrl"],"sources":["../src/index.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { URL } from 'url';\nimport isURLValidator from 'validator/lib/isURL';\n\nimport { HEADERS } from '@verdaccio/core';\n\nconst debug = buildDebug('verdaccio:core:url');\n\nconst validProtocols = ['https', 'http'];\n\n/**\n * Check if URI is starting with \"http://\", \"https://\" or \"//\"\n * @param {string} uri\n */\nexport function isURLhasValidProtocol(uri: string): boolean {\n return /^(https?:)?\\/\\//.test(uri);\n}\n\nexport function isHost(url: string = '', options = {}): boolean {\n return isURLValidator(url, {\n require_host: true,\n allow_trailing_dot: false,\n require_valid_protocol: false,\n // @ts-ignore\n require_port: false,\n require_tld: false,\n ...options,\n });\n}\n\n/**\n * Detect running protocol (http or https)\n */\nexport function getWebProtocol(headerProtocol: string | void, protocol: string): string {\n let returnProtocol;\n const [, defaultProtocol] = validProtocols;\n // HAProxy variant might return http,http with X-Forwarded-Proto\n if (typeof headerProtocol === 'string' && headerProtocol !== '') {\n debug('header protocol: %o', protocol);\n const commaIndex = headerProtocol.indexOf(',');\n returnProtocol = commaIndex > 0 ? headerProtocol.slice(0, commaIndex) : headerProtocol;\n } else {\n debug('req protocol: %o', headerProtocol);\n returnProtocol = protocol;\n }\n\n return validProtocols.includes(returnProtocol) ? returnProtocol : defaultProtocol;\n}\n\nexport function wrapPrefix(prefix: string | void): string {\n if (prefix === '' || typeof prefix === 'undefined' || prefix === null) {\n return '';\n } else if (!prefix.startsWith('/') && prefix.endsWith('/')) {\n return `/${prefix}`;\n } else if (!prefix.startsWith('/') && !prefix.endsWith('/')) {\n return `/${prefix}/`;\n } else if (prefix.startsWith('/') && !prefix.endsWith('/')) {\n return `${prefix}/`;\n } else {\n return prefix;\n }\n}\n\n/**\n * Create base url for registry.\n * @return {String} base registry url\n */\nexport function combineBaseUrl(protocol: string, host: string, prefix: string = ''): string {\n debug('combined protocol %o', protocol);\n debug('combined host %o', host);\n const newPrefix = wrapPrefix(prefix);\n debug('combined prefix %o', newPrefix);\n const groupedURI = new URL(wrapPrefix(prefix), `${protocol}://${host}`);\n const result = groupedURI.href;\n debug('combined url %o', result);\n return result;\n}\n\nexport function validateURL(publicUrl: string | void) {\n try {\n const parsed = new URL(publicUrl as string);\n if (!validProtocols.includes(parsed.protocol.replace(':', ''))) {\n throw Error('invalid protocol');\n }\n return true;\n } catch (err: any) {\n // TODO: add error logger here\n return false;\n }\n}\n\nexport type RequestOptions = {\n host: string;\n protocol: string;\n headers: { [key: string]: string };\n remoteAddress?: string;\n};\n\nexport function getPublicUrl(url_prefix: string = '', requestOptions: RequestOptions): string {\n if (validateURL(process.env.VERDACCIO_PUBLIC_URL as string)) {\n const envURL = new URL(wrapPrefix(url_prefix), process.env.VERDACCIO_PUBLIC_URL as string).href;\n debug('public url by env %o', envURL);\n return envURL;\n } else if (requestOptions.headers['host']) {\n const host = requestOptions.headers['host'];\n if (!isHost(host)) {\n throw new Error('invalid host');\n }\n const protoHeader =\n process.env.VERDACCIO_FORWARDED_PROTO?.toLocaleLowerCase() ??\n HEADERS.FORWARDED_PROTO.toLowerCase();\n const protocol = getWebProtocol(requestOptions.headers[protoHeader], requestOptions.protocol);\n const combinedUrl = combineBaseUrl(protocol, host, url_prefix);\n debug('public url by request %o', combinedUrl);\n return combinedUrl;\n } else {\n return '/';\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,KAAK,GAAG,IAAAC,cAAA,EAAW,oBAAX,CAAd;AAEA,MAAMC,cAAc,GAAG,CAAC,OAAD,EAAU,MAAV,CAAvB;AAEA;AACA;AACA;AACA;;AACO,SAASC,qBAAT,CAA+BC,GAA/B,EAAqD;EAC1D,OAAO,kBAAkBC,IAAlB,CAAuBD,GAAvB,CAAP;AACD;;AAEM,SAASE,MAAT,CAAgBC,GAAW,GAAG,EAA9B,EAAkCC,OAAO,GAAG,EAA5C,EAAyD;EAC9D,OAAO,IAAAC,cAAA,EAAeF,GAAf,EAAoB;IACzBG,YAAY,EAAE,IADW;IAEzBC,kBAAkB,EAAE,KAFK;IAGzBC,sBAAsB,EAAE,KAHC;IAIzB;IACAC,YAAY,EAAE,KALW;IAMzBC,WAAW,EAAE,KANY;IAOzB,GAAGN;EAPsB,CAApB,CAAP;AASD;AAED;AACA;AACA;;;AACO,SAASO,cAAT,CAAwBC,cAAxB,EAAuDC,QAAvD,EAAiF;EACtF,IAAIC,cAAJ;EACA,MAAM,GAAGC,eAAH,IAAsBjB,cAA5B,CAFsF,CAGtF;;EACA,IAAI,OAAOc,cAAP,KAA0B,QAA1B,IAAsCA,cAAc,KAAK,EAA7D,EAAiE;IAC/DhB,KAAK,CAAC,qBAAD,EAAwBiB,QAAxB,CAAL;IACA,MAAMG,UAAU,GAAGJ,cAAc,CAACK,OAAf,CAAuB,GAAvB,CAAnB;IACAH,cAAc,GAAGE,UAAU,GAAG,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0-6-next.10",
|
|
4
|
+
"description": "url utilities resolver",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"private",
|
|
7
|
+
"package",
|
|
8
|
+
"repository",
|
|
9
|
+
"registry",
|
|
10
|
+
"enterprise",
|
|
11
|
+
"modules",
|
|
12
|
+
"proxy",
|
|
13
|
+
"server",
|
|
14
|
+
"verdaccio"
|
|
15
|
+
],
|
|
16
|
+
"main": "./build/index.js",
|
|
17
|
+
"types": "./build/index.d.ts",
|
|
18
|
+
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"homepage": "https://verdaccio.org",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=14",
|
|
23
|
+
"npm": ">=6"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "https",
|
|
27
|
+
"url": "https://github.com/verdaccio/verdaccio",
|
|
28
|
+
"directory": "packages/core/url-resolver"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/verdaccio/verdaccio/issues"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@verdaccio/core": "6.0.0-6-next.6",
|
|
38
|
+
"debug": "4.3.4",
|
|
39
|
+
"lodash": "4.17.21",
|
|
40
|
+
"validator": "13.7.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@verdaccio/types": "11.0.0-6-next.13",
|
|
44
|
+
"node-mocks-http": "1.11.0"
|
|
45
|
+
},
|
|
46
|
+
"funding": {
|
|
47
|
+
"type": "opencollective",
|
|
48
|
+
"url": "https://opencollective.com/verdaccio"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"clean": "rimraf ./build",
|
|
52
|
+
"test": "jest",
|
|
53
|
+
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
54
|
+
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
55
|
+
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
|
|
56
|
+
"watch": "pnpm build:js -- --watch",
|
|
57
|
+
"build": "pnpm run build:js && pnpm run build:types"
|
|
58
|
+
},
|
|
59
|
+
"readme": "# Streams\n\n[](https://circleci.com/gh/ayusharma/@verdaccio/streams)\n[](https://codecov.io/gh/verdaccio/streams)\n[](https://www.npmjs.com/package/@verdaccio/streams)\n[](https://opencollective.com/verdaccio)\n[](http://chat.verdaccio.org/)\n\n[](https://www.npmjs.com/package/@verdaccio/streams)\n\nThis project provides an extension of `PassThrough` stream.\n\n## Detail\n\nIt provides 2 additional methods `abort()` and `done()`. Those implementations are widely use in the verdaccio core for handle `tarballs`.\n\n## License\n\nMIT (http://www.opensource.org/licenses/mit-license.php)\n"
|
|
60
|
+
}
|
package/src/index.ts
CHANGED