-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make require work with HTTPS scheme #1037
Labels
enhancement
evaluation needed
proposal needs to be validated or tested before fully implementing it in k6
js-compat
refactor
ux
Comments
mstoykov
added
enhancement
ux
refactor
evaluation needed
proposal needs to be validated or tested before fully implementing it in k6
labels
May 31, 2019
The specification doesn't really specify how and from where a
|
mstoykov
added a commit
that referenced
this issue
Jun 7, 2019
Previously remote modules were supported specifically without scheme. With this change we specifically prefer if they are with a scheme. The old variant is supported but prints a warning. Other changes: - If remote module requires a relative/absolute path that doesn't have a scheme it is relative/absolute given the remote module url. - Support local files with `file` scheme. fix #1037
mstoykov
added a commit
that referenced
this issue
Jun 26, 2019
This includes also change to the archive file structure. Now instead of separating files by whether they are scripts or no, they are separated based on whether their URI scheme. Through the (majority) of k6 now instead of simple strings a url.URL is used to idenitify files(scripts or otherwise). This also means that all imports or `open` can have schemes. Previously remote modules were supported specifically without scheme. With this change we specifically prefer if they are with a scheme. The old variant is supported but logs a warning. Additionally if remote module requires a relative/absolute path that doesn't have a scheme it is relative/absolute given the remote module url. Because of some of the changes, now caching is done through a afero.Fs instead of additional map. This also fixes not laoding remotely imported files from an archive, but instead requesting them again. fixes #1037, closes #838, fixes #887 and fixes #1051
mstoykov
added a commit
that referenced
this issue
Jul 31, 2019
This also includes a change to the archive file structure. Now instead of separating files by whether they are scripts or not, they are separated based on their URI scheme. Throughout the (majority) of k6 now, instead of simple strings, a url.URL is used to identify files (scripts or otherwise). This also means that all imports can have schemes. Previously remote modules were supported specifically without a scheme. With this change k6 prefers if they are with a scheme. The old variant is supported, but logs a warning. Additionally if remote module requires a relative/absolute path that doesn't have a scheme, it is relative/absolute given the remote module url. Because of some of the changes, now caching is done through a afero.Fs instead of additional maps. This also fixes the remotely imported files not properly loading from an archive, but instead requesting them again. This is supported with old archives and for github/cdnjs's shortcut loaders. For future-proof reasons the archive now also records the GOOS value of the k6 that generated it. Anonymize case insensitively as windows paths are (usually) case insensitive. fixes #1037, closes #838, fixes #887 and fixes #1051
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
evaluation needed
proposal needs to be validated or tested before fully implementing it in k6
js-compat
refactor
ux
Currently require() works with urls but ... it is very strange and IMO confusing and error prone.
k6
or/
or./
as urls which leads to confusing messages if you decide thatfile.js
should get you./file.js
. Funilly the messages says that it tried, but as far as I can see it doesn't and if you change it to./file.js
it does work so ... yeah buggy.My proposal is
https
as scheme (possibly file:// as well)https://
- explaining that this will be deprecated. We should also probably change the error message if we try and weren't able to something that also points out that they should probably not do it like this../
in front in case . Dunno if we actually want this or should we just reserve non scheme non./
|/
prefaced imports just for k6.The text was updated successfully, but these errors were encountered: