cold-toothbrush-60276
12/07/2022, 4:17 PM// ../node_modules/@pulumi/pulumi/proto/status_pb.js
var require_status_pb = __commonJS({
"../node_modules/@pulumi/pulumi/proto/status_pb.js"(exports2) {
var jspb2 = require_google_protobuf();
var goog2 = jspb2;
var global2 = function() {
return this || window || global2 || self || Function("return this")(); <-----------------
}.call(null);
var google_protobuf_any_pb = require_any_pb();
goog2.object.extend(proto, google_protobuf_any_pb);
goog2.exportSymbol("proto.google.rpc.Status", null, global2);
proto.google.rpc.Status = function(opt_data) {
jspb2.Message.initialize(this, opt_data, 0, -1, proto.google.rpc.Status.repeatedFields_, null);
};
worried-rain-74420
12/08/2022, 1:17 AMwindow
with another identifier, I can't remember which.this
for instancecold-toothbrush-60276
12/08/2022, 9:35 AMthis
is already present…window
as an option in the first place… looks like a copy paste job to me… window
should never even be an option in something never meant to run in a browser…worried-rain-74420
12/08/2022, 4:19 PMthis
, just that I believe you can safely replace window
with this
to sidestep the bug, since this
should always be defined anyway. Essentially, we're just looking for a way to remove the || window
expression from that statement, since we know window
will never be present and will only cause issues. By replacing || window
with || this
, you end up with the harmless code return this || this || global2 ...
which is unhygenic, but lets you work around this bug. I believe the bug originates upstream.cold-toothbrush-60276
12/10/2022, 7:12 PMsed -i -e "s/window||d2e||self/d2e/g" path/to/index.js
worried-rain-74420
12/11/2022, 8:31 PM@pulumi/pulumi/cmd/run
and executes that file, which is the entrypoint for NodeJS execution. You can bundle your program with ESBuild, but you still have to have @pulumi/pulumi
installed unbundled so we can boot the runtime itself.cold-toothbrush-60276
12/11/2022, 8:32 PMworried-rain-74420
12/11/2022, 8:34 PM@pulumi/pulumi
— e.g. automation api, tests, etc.
But we will always need some entrypoint into the NodeJS runtime. One other solution I’ve thought of is to install the runtime with the other language plugins — located at $PULUMI_HOME/bin
. Then, user programs would be able to fully bundle.cold-toothbrush-60276
12/11/2022, 8:34 PMworried-rain-74420
12/11/2022, 8:45 PMnix profile install
to grab most of my CLI tools lmao
I tried that... it complains about other missing packages thenI believe I got this to work in the past. I might look again at #10210 over the Christmas break. I want to try bundling with SWC if I can, hoping for a performance improvement. If there’s no perf improvement, I doubt we’d ship the change. I’ll also make a note to open an issue about decoupling the NodeJS runtime from the installed
@pulumi/pulumi
package (moving the runtime into $PULUMI_HOME/bin
). It’s possible that has to wait until v4.0 since it could be breaking. I’m not sure what other languages do. I think Python is the same, which makes me think maybe all of our languages are the same.
As an aside, I’ve also looked int minifying (but not bundling!) providers code. If you’re using e.g. AWS Native, the Node code for AWS Native is not minified. (We don’t want to bundle it because then using an S3 bucket would import every single AWS resource, which would kill performance). I figured if we minify the providers, then we’d improve performance (I was also able to preserve source maps after minification, so debugging doesn’t suffer). However, I found that the minified code produced by SWC is slower than unminified code produces by TSC. I’ve got a few bugs in my analysis, but that’s where I got hung up. (More info here.) Curious to hear your thoughts on this!
Signing off for the weekend! Good chatting with you! I’ll follow up on the issue tomorrow.cold-toothbrush-60276
12/11/2022, 8:50 PMworried-rain-74420
12/13/2022, 3:51 PMnode_modules
, then npm install @pulumi/pulumi
. That should pull in the remaining dependencies, right? e.g. grpc/grpc-js
cold-toothbrush-60276
12/13/2022, 3:52 PMworried-rain-74420
12/13/2022, 3:57 PMpulumictl
and I think Pulumi itself?cold-toothbrush-60276
12/13/2022, 3:58 PMworried-rain-74420
12/13/2022, 3:58 PMpulumictl
. https://github.com/t0yv0/pulumi-nix-devenv-flakecold-toothbrush-60276
12/13/2022, 4:01 PMenough-garden-22763
12/13/2022, 4:33 PMnpm ci
directives like to go and issue HTTP requests breaking Nix sandboxing model - there was at least one program I've ran into that I could not package at all. And in the case of Python, venv
is probably a bit better behaved but still has some scary interactions with the Nix model especially when native dependencies are involved, which may have been installed systemwide.cold-toothbrush-60276
12/13/2022, 4:57 PMworried-rain-74420
12/14/2022, 3:46 AM@pulumi/pulumi
packages from node_modules
(I tested this locally with success).node_modules
anymore.