Open vecerek opened 1 month ago
Wow, that's weird; I really can't figure out who is to blame.
Turning on NODE_DEBUG=module
gets a little more output like:
MODULE 9: Module._load REQUEST worker_threads parent: /ts-proto/node_modules/esbuild/lib/main.js
MODULE 9: load built-in module worker_threads
MODULE 9: looking for "/ts-proto/integration/protoc-gen-ts_proto" in ["/root/.node_modules","/root/.node_libraries","/usr/local/lib/node"]
MODULE 9: load "/ts-proto/integration/protoc-gen-ts_proto" for module "data:text/javascript,%23!%2Fusr%2Fbin%2Fenv%20node%0A(()%3D%3E%7B%0Arequire(%22..%2Fsrc%2Fplugin%22)%3B%0A%7D)()%0A?filePath=%2Fts-proto%2Fintegration%2Fprotoc-gen-ts_proto"
/ts-proto/integration/protoc-gen-ts_proto:5
?filePath=/ts-proto/integration/protoc-gen-ts_proto
^
SyntaxError: Invalid regular expression flags
at wrapSafe (node:internal/modules/cjs/loader:1469:18)
at Module._compile (node:internal/modules/cjs/loader:1491:20)
at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
at Object.transformer (/ts-proto/node_modules/tsx/dist/register-DpmFHar1.cjs:2:953)
at Module.load (node:internal/modules/cjs/loader:1317:32)
at Module._load (node:internal/modules/cjs/loader:1127:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
And it seems like it's this data:text/javascript,.../usr/bin/env but url encoded
that node says "has an invalid regexp flag".
Not sure if this is tsx
doing something wrong, or node's own /usr/env/env node
support going wrong; probably the latter?
I scanned through tsx and node open issues and didn't find anything...
If I update ./integration/protoc-gen-ts_proto
to just console.log:
#!/usr/bin/env node
// require('../src/plugin')
console.log("HELLO!");
Then I can run it directly like ./protoc-gen-ts_proto
and see HELLO
But if I run ./update-code.sh simple
and have ./protoc-gen-ts_proto
invoked via protoc, I get the same:
MODULE 859119: load "/home/stephen/other/ts-proto/integration/protoc-gen-ts_proto" for module "data:text/javascript,%23!%2Fusr%2Fbin%2Fenv%20node%0A(()%3D%3E%7B%0Aconsole.log(%22HELLO!%22)%3B%0A%7D)()%0A?filePath=%2Fhome%2Fstephen%2Fother%2Fts-proto%2Fintegration%2Fprotoc-gen-ts_proto"
What's interesting is that it looks like the contents of ./protoc-gen-ts_proto
are basically being URL encoded into this data:text/javascript,...
, I assume by the /usr/bin/env node
infra...
But that someone that is working just fine when invoking the file manually, but not working when protoc invokes it from within its plugin system... :thinking:
Integration test compilation fails during the execution of the
yarn proto2ts
command withSyntaxError: Invalid regular expression flags
.Steps to reproduce
ts-proto-protoc
image (if it exists).yarn proto2ts
Example error
Workaround
ts-proto-protoc
imageFROM node:current-slim
toFROM node:20-bullseye-slim
inprotoc.Dockerfile
.yarn proto2ts