Ask coding questions

← Back to all posts
How Repl works (specifically HTML repls)
xxpertHacker (555)

I'm pretty sure I'll need a Repl.it developer.

Background

If you make your own .replit file and configure it correctly, it will override the predefined default.

I have never seen nor accessed the predefined file, I have no proof it even exists, but creating your own file does work. (If you're a moderator please explain if anything here is wrong, and comment with what needs to be modified)

This can be applied to practically any Repl, but I found out it doesn't work with every Repl, as it failed on HTML Repls, so how do Repl.it's HTML Repls work? Are there any other Repls that will fail?

The actual question

If I'm correct, what do the predefined .replit files look like?

Ideally, I could view the code that is used in every Repl, because I am interested in what they contain.

Answered by eankeen (1407) [earned 5 cycles]
View Answer
Commentshotnewtop
eankeen (1407)

we know that repl handles html repls differently not just from those facts, but because loading time on html repls is much faster and doesn't have that loading / progress bar. i don't know precisely the differences between html repls and non-html repls.

you can find all repl types that are treated like non-html repls, or regular repls on their polygott repository. we know the environment of each repl of those different languages is the same. and by environment, i mean libraries (ex. libc), programming langauges (nodejs, python), binaries (ex. /bin/ls, /sbin/fdisk), and other stuff you would expect in a linux operating system. this is all pacakged up in a process container compliant with the OCI spec, (like a docker container). it does say 'base image', so i'm not sure exactly what kind of sugar they put on top, if any - would have to inspect a little bit more

and i doubt the difference in the existence and behaviors of a "predefined .replit file" is dependent on how the operating is setup. so it's not like replit patches the readdir syscall on the host machine or patches ls to specifically exclude .replit files, that would be absolutely ludicrous

and the only reference to .replit in their public code is in the same repository that i linked, in the polygott-gitignore file. they are specifically ignoring a folder called .replit

whether specifically this is stored in a file (unlikely) or whether the defaults can be accessed over an internal, beats me, so maybe someone else can shed some light over it

so if you actually open up one of the files in the repository i linked, you can see the defualt run command under the run stanza

so that directly answers your question XP

xxpertHacker (555)

@eankeen From what Highwayman informed me of, and my personal tests based upon that information, I’ve determined that their data isn’t stored in the “.replit” files. So I cannot know with 100% certainty what their default settings are, but thank you nonetheless

eankeen (1407)

@StudentFires you can see the defaults for each run command in the repository i linked

xxpertHacker (555)

@eankeen Umm... how is there a folder with a dot in its name?

eankeen (1407)

@StudentFires the ext4 filesystem stores files and folders exactly the same way with inodes (linux folers are files), and linux doesn't post that type of restrictions on files so i wouldn't see a reason why it wouldn't be totally valid.

but if you're asking about why it's there, maybe they plan to store extra replit-specific files in that folder in the future, and don't want that committed to version control, and don't want or can't (easily) update previous repls with the new .gitignore file (if they add it down the road instead of now). tbh i don't think there is much rhyme or reason, other than for 'just in case' and 'why not' purposes

eankeen (1407)

@StudentFires oh really? sounds incredibly odd

xxpertHacker (555)

@eankeen This is actually awesome! This includes languages that Repl doesn't display. I've been wanting to start learning WASM for some time now, but to see that Repl already supports it is pretty encouraging.

pyelias (1788)

@eankeen The command in the file you linked is the one used by run-project. The run button uses a different one in some cases.

eankeen (1407)

@pyelias oh interesting, which ones are those?

pyelias (1788)

.replit files control what command repl.it uses to run code in languages that are run server-side. HTML repls don't actually execute any code when they are run, so .replit files don't change anything. There are a few other languages that aren't run server-side (the new Basic, some esolangs, etc.), most of which don't have files at all (but if they did, .replit wouldn't work).

It's hard to be sure, but I don't think the default run settings are determined with .replit files. In languages without prybar, the default settings create a bash shell, while languages with prybar replace that with an interactive console for that language. If you add a .replit file to a prybar language repl, it will revert back to a bash shell. As far as I know, there's no way to hide the shell using a .replit file, so it's more likely that there's something more powerful somewhere else that's changing how the code is run.

Excluding that, the interactive shell can be replicated with a command like prybar-<insert language here> -i --ps1=?? --ps2=?? <insert main file here>, where ps1 is some unicode character combined with ANSI color codes and ps2 depends on the language. I don't know if this is actually what happens, but it seems to do the same thing.

In languages without prybar, the bash shell shows the command being run, so while there may be no .replit file, it's easy to make one that has the same behavior.

Highwayman (1396)

@pyelias

In languages without prybar, the bash shell shows the command being run, so while there's no .replit file, it's easy to make one that has the same behavior.

Ye, I do that all the time it’s so good lol

matthewlarrubia (0)

@pyelias Is it possible to run multiple .html files?

xxpertHacker (555)

@matthewlarrubia You can't "run" an HTML file to begin with.

matthewlarrubia (0)

@xxpertHacker Im sorry how do you "serve" multiple HTML files?

xxpertHacker (555)

@matthewlarrubia Do you mean at once to the same client or one per URL? Unless you're thinking of something entirely different.

Highwayman (1396)

Just a little thing that I thought to add,,,,
Repl.it also has a little tool called run-project that makes program compilation far more uniform, determining the language type and what to compile / run for you. Also if you check all the hidden files on a repl, I’ve found a config file named .upm, which leads me to believe that the .replit file’s language argument is basically just being passed to that probably. So maybe it’s more like they just run-project everything and slap a partially configured .upm file on it.

PDanielY (1151)

@Highwayman upm is the package manager that repl.it uses. upm means Universal Package Manager

xxpertHacker (555)

@Highwayman I think I've seen this too, but how did you “check all the hidden files on a Repl”?

xxpertHacker (555)

@Highwayman That isn’t proper English, Espanol, or Deutsch, so I cannot translate Is -a.

Highwayman (1396)

@StudentFires oops it’s supposed to ls -a

xxpertHacker (555)

@Highwayman What the hell does that mean?

Highwayman (1396)

@StudentFires also I do a lot of just walking around the vm

xxpertHacker (555)

@Highwayman Okay, it's the Bash command, that makes more sense.

Highwayman (1396)

@StudentFires in bash if you do the command ls -a, then it will list all the files (including hidden files) in the current dir.

xxpertHacker (555)

@Highwayman I’m checking this out right now. So does this mean that @PDanielY is wrong?

xxpertHacker (555)

@Highwayman Read the long chat between me & him. Also, how do I access the contents of the “hidden” files? Can I make then viewable like normal?

Highwayman (1396)

@StudentFires ehhhhh idk. Maybe? Generally I just use the ci command or the cat command to see what’s in them.

PDanielY (1151)

@StudentFires No. If you look at all the hidden files there is not .replit file unless you create a .replit file

Highwayman (1396)

@PDanielY makes sense to me. I’m kinda convinced they just use run-project to run everything.

xxpertHacker (555)

@Highwayman Used cp command to get the files, unfortunately, nothing interesting.

Highwayman (1396)

@StudentFires :/ oh well. Maybe it’s something else then. 🤷‍♂️

xxpertHacker (555)

@Highwayman But I got a NodeJs .upm file! Still, uninteresting though.

Highwayman (1396)

@StudentFires lol. Unsurprising I guess, seeing as all it’d really be doing is talking about dependencies, ya?

xxpertHacker (555)

@Highwayman Yeah, like when you use require(...), so... I honestly can't say that's too cool. I was hoping to unearth the secrets of Repl or something.

PDanielY (1151)

I am not a mod anymore but I can answer the question so I will.

It does work on an HTML repl because repl.it runs an HTML repl on your computer instead of their computer and your computer doesn't know what .replit is so it doesn't work. And what do you mean by what is the predefined .replit file look like?

Highwayman (1396)

@PDanielY why aren’t you a mod anymore?

PDanielY (1151)

@Highwayman I got kicked out of mod and to this today I don't want to know why I got kicked. but I think it is because they thought I "abused my powers."

So I created a post asking people if they wanted to help me on a project and another moderator locked the post because they said it didn't have anything to do with repl.it and then I unlocked the post and eventually, the moderator deleted the post and I got kicked.

Highwayman (1396)

@PDanielY oh :( that’s too bad..

Welp, at least they didn’t delete you :)

rediar (402)

@Highwayman also he was underage, I believe

xxpertHacker (555)

@PDanielY Are there predefined .replit files at all? Also, did you read the entire question before answering?

PDanielY (1151)

@StudentFires Wait, who do you all repls have predefined .replit files? I think that is a lie. Repl.it just runs your repl the normal way you would run a nodejs or python program on your computer.

xxpertHacker (555)

@PDanielY Nope, I'm 100% sure of otherwise.
I wasn't told this though, I learned it myself.
Look at it here: https://repl.it/@StudentFires/TextRepl

PDanielY (1151)

@StudentFires Why would repl.it have a .replit file to run a repl? To run a nodejs repl they could literally just run this command on the terminal: node index.js

xxpertHacker (555)

@PDanielY That's why they have the .replit files. To configure what the RUN button does, for example, C++ needs to be compiled, so it is something along the lines of language="c++" run="clang++-7 -pthread -o main main.cpp; ./main", while the NodeJS looks something like language="nodejs" run="node index.js"

PDanielY (1151)

@StudentFires BUT they don't need a .replit file they could just program that in. If the repl is a C# repl run this code to compile the repl unless there is .replit file

xxpertHacker (555)

@PDanielY And that “.replit” file may very well be programmed in, but I have no proof of either, as I'm not a Repl.it developer. That “nodejs” example I've personally seen myself.

PDanielY (1151)

@StudentFires I am not a repl.it developer but I know that as a fact. They only created the .replit file for people who want to change how the repl will run

xxpertHacker (555)

@PDanielY So, is there a way to find out how the Repl will run by default?

PDanielY (1151)

@StudentFires the repl will use the language's compiler. If you have a python repl it will use the Python's compiler to run the repl and for a nodejs repl, it will use the Node's compiler to run the repl.

xxpertHacker (555)

@PDanielY So, you're 100% sure they don't use their own .replit files? Also, neither Python nor JS use a compiler, they use interpreters. Not 100% true for JS anymore but...

xxpertHacker (555)

@PDanielY Do you have any proof? Also, there's that .01% skepticism, so idk.

xxpertHacker (555)

@PDanielY Honestly, I just wanted to make an XHTML repl, because I hate HTML. I didn't want to have to make a whole server or a single file every time.

Where can we request a new language?