Guy Bedford
41af927efb
module: exports pattern support
...
Backport-PR-URL: https://github.com/nodejs/node/pull/35757
PR-URL: https://github.com/nodejs/node/pull/34718
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-11-16 11:57:51 -05:00
Guy Bedford
d9857fdbc2
module: custom --conditions flag option
...
PR-URL: https://github.com/nodejs/node/pull/34637
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-10-01 11:32:44 -07:00
Guy Bedford
d065334d42
module: package "imports" field
...
PR-URL: https://github.com/nodejs/node/pull/34117
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
2020-10-01 11:32:36 -07:00
Kirill Shatskiy
3559471153
esm: share package.json cache between ESM and CJS loaders
...
Refs: https://github.com/nodejs/node/issues/30674
PR-URL: https://github.com/nodejs/node/pull/33229
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
2020-07-08 11:53:29 -07:00
Daniele Belardi
daf1d842cc
esm: improve commonjs hint on module not found
...
Run CommonJS resolver only if `error.code` is ERR_MODULE_NOT_FOUND.
Avoid using absolute paths in hint by:
* using a parent-relative path if the specifier is a relative path
* using a `pkg/x.js` format if the specifier is bare (e.g. `pkg/x`)
PR-URL: https://github.com/nodejs/node/pull/31906
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2020-05-13 17:53:02 +02:00
Guy Bedford
b1f08b8359
module: no type module resolver side effects
...
PR-URL: https://github.com/nodejs/node/pull/33086
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
2020-05-13 17:53:00 +02:00
Guy Bedford
1811a10415
module: exports not exported for null resolutions
...
PR-URL: https://github.com/nodejs/node/pull/32838
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-05-13 17:52:47 +02:00
Myles Borins
3dc3772bb0
module: improve error for invalid package targets
...
For targets that are strings that do not start with `./` or `/` the
error will now have additional information about what the programming
error is.
Closes: https://github.com/nodejs/node/issues/32034
PR-URL: https://github.com/nodejs/node/pull/32052
Fixes: https://github.com/nodejs/node/issues/32034
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Signed-off-by: Myles Borins <myles.borins@gmail.com >
2020-05-13 17:52:47 +02:00
Jan Krems
b62910c851
module: expose exports conditions to loaders
...
PR-URL: https://github.com/nodejs/node/pull/31303
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
2020-04-28 16:19:34 +02:00
Guy Bedford
717f9c5905
module: path-only CJS exports extension searching
...
Backport-PR-URL: https://github.com/nodejs/node/pull/32883
PR-URL: https://github.com/nodejs/node/pull/32351
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2020-04-17 17:20:23 -04:00
Guy Bedford
c537afb18c
module: package "exports" error refinements
...
Backport-PR-URL: https://github.com/nodejs/node/pull/32610
PR-URL: https://github.com/nodejs/node/pull/31625
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-04-03 15:56:41 -04:00
Guy Bedford
fcbc7756fe
module: logical conditional exports ordering
...
PR-URL: https://github.com/nodejs/node/pull/31008
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-02-06 02:49:37 +00:00
Guy Bedford
7f4ee67435
module: self resolve bug fix and esm ordering
...
PR-URL: https://github.com/nodejs/node/pull/31009
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-02-06 02:48:56 +00:00
Guy Bedford
bb06225341
module: conditional exports import condition
...
PR-URL: https://github.com/nodejs/node/pull/30799
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2020-02-06 02:48:55 +00:00
Rongjian Zhang
dc084f9e33
module: add warnings for experimental flags
...
PR-URL: https://github.com/nodejs/node/pull/30617
Fixes: https://github.com/nodejs/node/issues/30600
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2020-02-06 02:48:55 +00:00
Guy Bedford
680ae770ab
module: conditional exports with flagged conditions
...
PR-URL: https://github.com/nodejs/node/pull/29978
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2020-02-06 02:48:52 +00:00
Jan Krems
121c845714
module: resolve self-references
...
Adds the ability to `import` or `require` a package from within its
own source code. This allows tests and examples to be written using
the package name, making them easier to reuse by consumers of the
package.
Assuming the `name` field in `package.json` is set to `my-pkg`, its
test could use `require('my-pkg')` or `import 'my-pkg'` even if
there's no `node_modules/my-pkg` while testing the package itself.
An important difference between this and relative specifiers like
`require('../')` is that self-references use the public interface
of the package as defined in the `exports` field while relative
specifiers don't.
This behavior is guarded by a new experimental flag
(`--experimental-resolve-self`).
PR-URL: https://github.com/nodejs/node/pull/29327
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2020-02-06 02:48:50 +00:00
Guy Bedford
cb162298eb
module: pkg exports validations and fallbacks
...
PR-URL: https://github.com/nodejs/node/pull/28949
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2019-08-19 21:18:59 +02:00
Jan Krems
d9084d29fe
module: unify package exports test for CJS and ESM
...
Refs: https://github.com/nodejs/modules/issues/358
PR-URL: https://github.com/nodejs/node/pull/28831
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-02 22:24:06 +02:00
Jan Krems
2262526562
module: implement "exports" proposal for CommonJS
...
Refs: https://github.com/jkrems/proposal-pkg-exports/issues/36
Refs: https://github.com/nodejs/node/pull/28568
PR-URL: https://github.com/nodejs/node/pull/28759
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
2019-08-02 22:18:58 +02:00
Guy Bedford
b379c0e8b6
esm: implement "pkg-exports" proposal
...
Refs: https://github.com/jkrems/proposal-pkg-exports/issues/36
PR-URL: https://github.com/nodejs/node/pull/28568
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-07-20 11:29:59 +02:00
Ruben Bridgewater
1940114ac3
util: highlight stack frames
...
Using `util.inspect` on errors is going to highlight userland and
node_module stack frames from now on. This is done by marking Node.js
core frames grey and frames that contain `node_modules` in their path
yellow.
That way it's easy to grasp what frames belong to what code.
PR-URL: https://github.com/nodejs/node/pull/27052
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-15 17:30:50 +02:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.
Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155
Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Gibson Fahnestock
3d2aef3979
test: s/assert.equal/assert.strictEqual/
...
Use assert.strictEqual instead of assert.equal in tests, manually
convert types where necessary.
PR-URL: https://github.com/nodejs/node/pull/10698
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
2017-01-11 14:19:26 +00:00
cjihrig
ff1efa6087
test: use const for all require() calls
...
PR-URL: https://github.com/nodejs/node/pull/10550
Reviewed-By: Rich Trott <rtrott@gmail.com >
2017-01-02 18:28:18 -05:00
Evan Lucas
e248f7f9e7
repl: allow autocompletion for scoped packages
...
Previously, autocompletion of scoped packages was not supported by the
repl due to not including the `@` character in the regular expression.
PR-URL: https://github.com/nodejs/node/pull/10296
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-12-22 22:03:39 -08:00
Ben Noordhuis
213ede6cee
repl: fix require('3rdparty') regression
...
Fix module loading of third-party modules in the REPL by inheriting
module.paths from the REPL's parent module.
Commit ee72ee7 ("module,repl: remove repl require() hack") introduced
a regression where require() of modules in node_modules directories
no longer worked in the REPL (and fortunately only in the REPL.)
It turns out we didn't have test coverage for that but we do now.
Fixes: https://github.com/nodejs/node/issues/4208
PR-URL: https://github.com/nodejs/node/pull/4215
Reviewed-By: Roman Reiss <me@silverwind.io >
2015-12-09 23:30:02 +01:00
isaacs
3e1b1dd4a9
Remove excessive copyright/license boilerplate
...
The copyright and license notice is already in the LICENSE file. There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Colton Baker
87286cc737
Fixed a lot of jslint errors.
...
Fixes #1831
2011-10-05 18:51:06 -07:00
Mathias Buus
39246f65df
Closes #1177 remove one node_modules optimization
...
to better support certain project structures.
2011-06-14 15:32:41 -07:00
Ryan Dahl
55048cdf79
Update copyright headers
2011-03-14 17:37:05 -07:00
isaacs
81b4d45354
Better assert in the node_modules tests
2011-02-09 14:35:08 -08:00
isaacs
46513483cd
node_modules module lookup, +docs and test.
2011-02-09 14:24:22 -08:00