Antoine du Hamel
e2bd64ddfe
url: refactor pathToFileURL to native
...
PR-URL: https://github.com/nodejs/node/pull/55476
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-10-31 21:11:27 +00:00
Yagiz Nizipli
303606690f
src: move FromNamespacedPath to path.cc
...
PR-URL: https://github.com/nodejs/node/pull/53540
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-06-27 14:56:33 +00:00
Yagiz Nizipli and Daniel Lemire
f13dbfd43a
src: move package resolver to c++
...
Co-authored-by: Daniel Lemire <daniel@lemire.me >
PR-URL: https://github.com/nodejs/node/pull/50322
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-17 00:16:38 +00:00
Yagiz Nizipli
b24215e35f
fs,url: move FromNamespacedPath to node_url
...
PR-URL: https://github.com/nodejs/node/pull/50090
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-10-26 02:26:40 +00:00
Yagiz Nizipli
f0995d1476
fs,url: refactor FileURLToPath method
...
PR-URL: https://github.com/nodejs/node/pull/50090
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-10-26 02:26:38 +00:00
Yagiz Nizipli
557f928564
fs,url: move FileURLToPath to node_url
...
PR-URL: https://github.com/nodejs/node/pull/50090
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-10-26 02:26:37 +00:00
Daniel Lemire
c89bae161b
src: use find instead of char-by-char in FromFilePath()
...
PR-URL: https://github.com/nodejs/node/pull/50288
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2023-10-24 18:09:08 +00:00
Yagiz Nizipli
c829c03df2
url: improve invalid url performance
...
PR-URL: https://github.com/nodejs/node/pull/49692
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-09-26 15:40:17 +00:00
Yagiz Nizipli
607a545904
url: overload canParse V8 fast api method
...
PR-URL: https://github.com/nodejs/node/pull/48993
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2023-08-12 22:34:46 +00:00
Yagiz Nizipli
e0500d6e88
url: fix canParse false value when v8 optimizes
...
PR-URL: https://github.com/nodejs/node/pull/48817
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-07-17 20:29:05 -04:00
Yagiz Nizipli
72ba09905a
lib: reduce URL invocations on http2 origins
...
PR-URL: https://github.com/nodejs/node/pull/48338
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2023-06-07 02:15:43 +00:00
Joyee Cheung
c0365fd52a
src: avoid prototype access in binding templates
...
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.
Previously the initialization was similar to:
```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```
Now it's similar to:
```
module.exports = { property: ... };
```
PR-URL: https://github.com/nodejs/node/pull/47913
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-05-24 16:45:05 +02:00
Joyee Cheung
5466bec2c5
bootstrap: initialize per-isolate properties of bindings separately
...
This patch moves the initialization of per-isolate properties of
the bindings that are in the embedded snapshot separate from the
initialization of their per-context properties. This is necessary
for workers to share the isolate snapshot with the main thread
and deserialize these properties instead of creating them from
scratch.
PR-URL: https://github.com/nodejs/node/pull/47768
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2023-05-03 13:15:10 +00:00
Khafra
6675505686
src: add v8 fast api for url canParse
...
PR-URL: https://github.com/nodejs/node/pull/47552
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-04-20 16:16:21 +00:00
Yagiz Nizipli
3867641c14
url: use ada::url_aggregator for parsing urls
...
PR-URL: https://github.com/nodejs/node/pull/47339
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2023-04-05 09:05:27 -07:00
Yagiz Nizipli
c4581abff6
url: replace url-parser with ada
...
PR-URL: https://github.com/nodejs/node/pull/46410
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2023-02-06 19:21:39 +00:00
Yagiz Nizipli
85f9b27c14
url: remove unused URL::ToFilePath()
...
PR-URL: https://github.com/nodejs/node/pull/46487
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-02-05 15:30:22 +00:00
Yagiz Nizipli
bea3a43a69
url: remove unused URL::toObject
...
PR-URL: https://github.com/nodejs/node/pull/46486
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-02-05 15:23:03 +00:00
Anna Henningsen
33ffaa49ba
src: use const reference instead of pointer in URL::SerializeURL
...
Just some general cleanup to make things C++-y instead of C-y.
PR-URL: https://github.com/nodejs/node/pull/41759
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2022-02-11 11:40:12 +00:00
XadillaX
38a15d832a
src,url: separate some tables out of node_url.cc
...
The purpose of separating is for readability and maintainability.
PR-URL: https://github.com/nodejs/node/pull/38988
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2021-06-17 11:08:32 +08:00
Daijiro Wachi
e40ed2856f
src: integrate URL::href() and use in inspector
...
PR-URL: https://github.com/nodejs/node/pull/35912
Refs: https://github.com/nodejs/node/issues/22610
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-11-22 00:02:32 +09:00
James M Snell
aee3e2bc4c
src: various minor improvements to node_url
...
Went hunting for possible performance improvements. Didn't find
anything significant but did manage to make a number of style
improvements that bring more in line with style guidelines and
good pratice.
PR-URL: https://github.com/nodejs/node/pull/31651
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-02-07 23:29:43 +01:00
Alexandre Ferrando
99c1238f54
src: change env.h includes for forward declarations
...
Due to how the Environment class is used through the codebase,
there are a lot of includes referencing either env.h or env-inl.h.
This can cause that when any development touches those libraries,
a lot of files have to be recompiled.
This commit attempts to change those includes by forward declarations
when possible to mitigate the issue.
Refs: https://github.com/nodejs/node/issues/27531
PR-URL: https://github.com/nodejs/node/pull/30133
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2019-10-31 14:11:05 +01:00
Sam Roberts
60b315c064
src: remove env-inl.h from header files
...
Inline headers should only be included into the .cc files that use them.
PR-URL: https://github.com/nodejs/node/pull/27755
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-05-23 08:51:41 -07:00
gengjiawen
8375c706ad
src: apply clang-tidy rule performance-unnecessary-value-param
...
PR-URL: https://github.com/nodejs/node/pull/26042
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-19 12:54:41 +01:00
Anna Henningsen
0043c6f548
src: pass along MaybeLocal<> state from URL::ToObject()
...
PR-URL: https://github.com/nodejs/node/pull/25141
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-12-31 01:10:36 +01:00
Tobias Nießen
1d9ec04693
url: use foreach-style C++ loop
...
PR-URL: https://github.com/nodejs/node/pull/23138
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-10-01 09:30:15 -04:00
Alexey Kozyatinskiy
cf340fe0f5
src: added URL::FromFilePath method
...
Method returns file URL from native file path.
PR-URL: https://github.com/nodejs/node/pull/22251
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-09-14 08:32:08 -07:00
Ayush Gupta
11892b0b64
url: introduce URL_FLAGS_IS_DEFAULT_SCHEME_PORT flag
...
Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured
when the parser detects that the port passed is the default port
for that scheme.
PR-URL: https://github.com/nodejs/node/pull/20479
Fixes: https://github.com/nodejs/node/issues/20465
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-18 15:24:05 +02:00
Anna Henningsen
e22a8f17a5
src: improve module loader readability
...
Various improvements on readability, performance and
conformity to the Node core coding style in the ESM loader C++ code:
- `isolate` for the `Isolate*`, `context` for the `Local<Context>`
- Less reliance on `auto` where it’s unnecessary/increases cognitive
overhead
- Shorter paths to failure via `.ToLocal()` & co
- Do not keep pending exceptions around e.g. for failed `JSON` parsing
- Use `Maybe` types to get explicit error status forwarding
- Remove an unnecessary handle scope
- Add `nullptr` checks for unwrapped host objects
- Remove unused code
- Use `CamelCase` for function names
- Use `const Foo&` instead of copying values whenever possible
- Pass along the `Environment*` explicitly
PR-URL: https://github.com/nodejs/node/pull/16536
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2017-11-03 01:10:31 +01:00
Joyee Cheung
cdb263d3ba
src: do not include x.h if x-inl.h is included
...
PR-URL: https://github.com/nodejs/node/pull/16548
Fixes: https://github.com/nodejs/node/issues/16519
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-30 18:56:38 +08:00
Sam Roberts
af6af08482
url: const-ify APIs, and pass URL by ref
...
Fixes warnings by Coverity Scan of inefficiences when passing by value
instead of passing by const reference.
PR-URL: https://github.com/nodejs/node/pull/15615
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-10-01 20:20:06 -03:00
Bradley Farias
c8a389e19f
module: Allow runMain to be ESM
...
This follows the EPS an allows the node CLI to have ESM as an entry point.
`node ./example.mjs`. A newer V8 is needed for `import()` so that is not
included. `import.meta` is still in specification stage so that also is not
included.
PR-URL: https://github.com/nodejs/node/pull/14369
Author: Bradley Farias <bradley.meck@gmail.com >
Author: Guy Bedford <guybedford@gmail.com >
Author: Jan Krems <jan.krems@groupon.com >
Author: Timothy Gu <timothygu99@gmail.com >
Author: Michaël Zasso <targos@protonmail.com >
Author: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2017-09-07 15:18:32 -05:00
Timothy Gu
841bb4c61f
url: fix C0 control and whitespace handling
...
PR-URL: https://github.com/nodejs/node/pull/12846
Fixes: https://github.com/nodejs/node/issues/12825
Refs: https://github.com/w3c/web-platform-tests/pull/5792
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-05-19 23:19:57 -07:00
Timothy Gu
ade80eeb1a
src: clean up WHATWG WG parser
...
* reduce indentation
* refactor URL inlined methods
* prefer templates over macros
* do not export ARG_* flags in url binding
PR-URL: https://github.com/nodejs/node/pull/12251
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-04-17 09:11:56 -07:00
Timothy Gu
4ddd23f0ec
src: WHATWG URL C++ parser cleanup
...
- Clarify port state
- Remove scheme flag
- Clarify URL_FLAG_TERMINATED
PR-URL: https://github.com/nodejs/node/pull/11917
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-03-29 22:19:33 -07:00
James M Snell
7139b93a8b
url: add ToObject method to native URL class
...
Provides a factory method to convert a native URL class
into a JS URL object.
```c++
Environment* env = ...
URL url("http://example.org/a/b/c?query#fragment ");
MaybeLocal<Value> val = url.ToObject(env);
```
PR-URL: https://github.com/nodejs/node/pull/12056
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-03-29 20:48:25 -07:00
James M Snell
51b007aaa7
test: add cctest for native URL class
...
PR-URL: https://github.com/nodejs/node/pull/12042
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-03-27 10:12:44 -07:00
Joyee Cheung
ee19e2923a
url: show input in parse error message
...
PR-URL: https://github.com/nodejs/node/pull/11934
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-03-23 07:59:50 -07:00
James M Snell
e26b6c6baa
src: add native URL class
...
Adds a URL native class for use within the node.js c/c++
code. This is primarily intended to be used by the eventual
ES6 modules implementation but can be used generally wherever
URL parsing within the c/c++ may be necessary.
```c
URL url1("http://example.org ");
URL url2("foo", "http://example.org/bar ");
URL url3("baz", &url2);
```
While we're at it, reduce reliance on macros to simplify impl.
PR-URL: https://github.com/nodejs/node/pull/11801
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-03-22 08:44:04 -07:00
Timothy Gu
d23123643d
src: make PercentDecode return void
...
It only returns 0, nor is it likely to have any error conditions in the
future.
PR-URL: https://github.com/nodejs/node/pull/11922
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-21 17:45:54 -07:00
James M Snell
4b312387ea
url: adding WHATWG URL support
...
Implements WHATWG URL support. Example:
```
var u = new url.URL('http://example.org ');
```
Currently passing all WHATWG url parsing tests and all but two of the
setter tests. The two setter tests are intentionally skipped for now
but will be revisited.
PR-URL: https://github.com/nodejs/node/pull/7448
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
2016-10-11 12:41:42 -07:00