0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/tools
Daniel Bevenius b4f0a18b5a tools: allow single JS file for --link-module
The description for the --link-module configuration option is as
follows:
$ ./configure --help | grep -A 5 'link-module'
  --link-module=LINKED_MODULE
                      Path to a JS file to be bundled in the binary as a
                      builtin. This module will be referenced by path
                      without extension; e.g. /root/x/y.js will be
                      referenced via require('root/x/y'). Can be used
                      multiple times

This lead me to think that it was possible to specify a file like this:
$ ./configure --link-module=something.js
$ NODE_DEBUG=mkcodecache make -j8

This will lead to a compilation error as an entry in the source_ map in
node_javascript.cc will end up having an empty string as its key:
source_.emplace("", UnionBytes{_raw, 105});

This will then be used by CodeCacheBuilder when it iterates over the
module ids, which will lead to the following compilation errors:

/node/out/Release/obj/gen/node_code_cache.cc:12:23: warning:
ISO C++17 does not allow a decomposition group to be
empty [-Wempty-decomposition]
static const uint8_t [] = {
                      ^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: warning:
decomposition declarations are a C++17 extension [-Wc++17-extensions]
static const uint8_t [] = {
                     ^~
/node/out/Release/obj/gen/node_code_cache.cc:12:1: error:
decomposition declaration cannot be declared 'static'
static const uint8_t [] = {
^~~~~~
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
decomposition declaration cannot be declared with type 'const uint8_t'
(aka 'const unsigned char'); declared type must be 'auto' or
reference to 'auto'
static const uint8_t [] = {
                     ^
/node/out/Release/obj/gen/node_code_cache.cc:12:22: error:
excess elements in scalar initializer
static const uint8_t [] = {
                     ^
/node/out/Release/obj/gen/node_code_cache.cc:660:7: error:
expected expression
      ,
      ^
/node/out/Release/obj/gen/node_code_cache.cc:661:24: error:
no matching function for call to 'arraysize'
      static_cast<int>(arraysize()), policy
                       ^~~~~~~~~
../src/util.h:667:18: note: candidate function template not viable:
requires 1 argument, but 0 were provided
constexpr size_t arraysize(const T (&)[N]) {
                 ^
2 warnings and 5 errors generated.

This commit suggests that passing a single file be allowed by modifying
tools/js2c.py.

PR-URL: https://github.com/nodejs/node/pull/28443
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-08-12 12:56:43 +02:00
..
bootstrap doc: fix link from bootstrap README to BUILDING 2019-07-02 16:02:27 -07:00
clang-format
code_cache tools: remove out-of-date code-cache-path comment 2019-06-28 05:10:46 +02:00
configure.d build: allow icu download to use other hashes besides md5 2019-04-26 08:24:04 -07:00
doc doc,tools: get altDocs versions from CHANGELOG.md 2019-06-01 10:17:30 +02:00
eslint-rules tools: decrease code duplication for isString() in lint rules 2019-05-17 20:56:26 -07:00
gyp build,tools: support building with Visual Studio 2019 2019-07-27 11:48:28 +02:00
icu deps: bump minimum icu version to 64 2019-06-01 10:00:42 -04:00
inspector_protocol tools: update inspector_protocol to 0aafd2 2019-06-01 09:28:34 +02:00
js2c_macros
macos-installer
msvs tools: sync gypfiles with V8 7.6 2019-08-01 12:56:46 +02:00
node_modules tools: update ESLint to 6.1.0 2019-07-22 22:32:11 -07:00
node-lint-md-cli-rollup tools: add markdown lint rule for 'Unix' 2019-07-11 22:42:21 -07:00
pip
rpm
snapshot src, tools: replace raw ptr with smart ptr 2019-07-12 21:59:36 -07:00
v8_gypfiles tools: sync gypfiles with V8 7.6 2019-08-01 12:56:46 +02:00
.eslintrc.yaml tools: enable camelcase linting in tools 2019-05-09 21:41:05 -07:00
build-addons.js
certdata.txt tools: update certdata.txt 2019-07-24 10:55:59 -07:00
check-imports.py
compress_json.py
cpplint.py
create_android_makefiles
create_expfile.sh
genv8constants.py
getarch.py tools: move python code out of jenkins shell 2019-07-02 06:08:03 +02:00
getendian.py tools: move python code out of jenkins shell 2019-07-02 06:08:03 +02:00
getmachine.py tools: move python code out of jenkins shell 2019-07-02 06:08:03 +02:00
getmoduleversion.py
getnapibuildversion.py build: expose napi_build_version variable 2019-07-01 22:07:42 -07:00
getnodeversion.py tools: move python code out of jenkins shell 2019-07-02 06:08:03 +02:00
gyp_node.py
install.py
js2c.py tools: allow single JS file for --link-module 2019-08-12 12:56:43 +02:00
license2rtf.js
license-builder.sh deps: update acorn to 6.2.0 2019-07-15 00:04:50 +02:00
lint-js.js tools: increase the maximum number of files to lint per worker 2019-06-11 15:59:20 +02:00
lint-md.js tools: add markdown lint rule for 'Unix' 2019-07-11 22:42:21 -07:00
lint-pr-commit-message.sh
lsan_suppressions.txt
macos-firewall.sh
make-v8.sh tools: fix v8 testing with devtoolset on ppcle 2019-07-02 06:07:37 +02:00
mk-ca-bundle.pl tls: expose built-in root certificates 2019-05-20 11:09:02 +02:00
mkssldef.py
osx-codesign.sh
osx-pkg-postinstall.sh
osx-productsign.sh
release.sh
run-valgrind.py
run-worker.js
sign.bat
specialize_node_d.py
test-npm-package.js
test-v8.bat
test.py test: use unique tmpdirs for each test 2019-08-10 19:21:26 -07:00
update-authors.js
update-babel-eslint.sh tools: fix update-babel-eslint.sh script 2019-06-11 15:59:21 +02:00
update-eslint.sh tools: update eslint 2019-06-27 11:57:19 +02:00
utils.py
valgrind.supp