Commit 1011a17
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: #28443
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>1 parent cb16229 commit 1011a17Copy full SHA for 1011a17
File tree
Expand file treeCollapse file tree
3 files changed
+22
-1
lines changedOpen diff view settings
Filter options
- test/tools
- tools
Expand file treeCollapse file tree
3 files changed
+22
-1
lines changedOpen diff view settings
Collapse file
+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
294 | 294 | |
295 | 295 | |
296 | 296 | |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | + |
297 | 301 | |
298 | 302 | |
299 | 303 | |
| ||
311 | 315 | |
312 | 316 | |
313 | 317 | |
| 318 | + |
314 | 319 | |
315 | 320 | |
316 | 321 | |
| ||
319 | 324 | |
320 | 325 | |
321 | 326 | |
| 327 | + |
322 | 328 | |
323 | 329 | |
324 | 330 | |
|
Collapse file
test/tools/test-js2c.py
Copy file name to clipboard+14Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
Collapse file
+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
261 | 261 | |
262 | 262 | |
263 | 263 | |
264 | | - |
| 264 | + |
| 265 | + |
265 | 266 | |
266 | 267 | |
267 | 268 | |
|
0 commit comments