-
Notifications
You must be signed in to change notification settings - Fork 632
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
clear files structure for submodules in std #2538
Comments
@lino-levan not quite. #2936 works on a file level basis, but not
|
Yes, it will be done in #2936. I've added Even though #2936 mainly deals with single-file exports, it can also tie in this restructure, IMO. I agree - |
My bad, didn't see the |
I literally just added it in 🤣
I agree with these, except for the last. Frankly, I don't think it's needed - |
The restructure should only be done for those encoding types that are large enough that they justify their own submodule. For example, |
Do you agree tough that we would put (csv as an example) |
I think |
I'm in favor of creating single-export entrypoints in subdirs, and moving test fixtures into subdirs, but not in favor of moving |
Having both |
I agree with @iuioiua. I think one entry point is more consistent, else the question can be asked why we don't have an entry point for every mod on the |
because we don't create an entrypoint in top level. I'm not enough convinced |
Yes, so why do we treat submodules differently, other than historically?
It is more consistent because in other modules we have a |
The current rule of thumb in
I think the current state is enough consistent with this rule. Exporting paths are enough predictable by this rule. So the transition from the above rule to the proposed rule doesn't improve the consistency in my view. And if it doesn't improve the consistency, we should stay in the current rule because these modules are heavily depended in the ecosystem, and the transition will affect too many modules. |
Having Either way, having both |
If we do breaking changes, what do you think about moving csv/toml/yaml/json/jsonc to top level? |
I think that would make more sense than the current structure. The |
@kt3k I think that is a good idea. What about front_matter and varint? |
@kt3k, should we pursue this change? |
Core members have been discussing this slowly. Please wait for a moment |
closing in favor of #3123 Thanks @timreichen for starting this discussion |
Is your feature request related to a problem? Please describe.
Submodules as in
std/encoding
have an unnecessary messy file structure and it will become even messier, if we don't introduce a strict file structure for submodules.An example of that was the introduction of
encoding/csv/stream.ts
, which expands a submodule and necessarily added aencoding/csv
directory for utility files. Now std has aencoding/csv
directory only for the stream API while the normalcsv
API lives top level NOT in a directory calledcsv
? This is very confusing and unexpected.All of the submodules have a top level entry point (
encoding/csv.ts
,encoding/hex.ts
for example), some have additional API (encoding/csv/stream.ts
) or/and need util or/and wasm files, some need test files. As of now, multiple modules have their files distributed all over theencoding
dir and some even outside std (seestd/_wasm_varint
)Here some examples, how disconnected their data and files are:
toml
toml.ts
as top level entry pointencoding/_toml
for utilitiesencoding/testdata
varint
varint.ts
as top level entry point../_wasm_varint
onstd
top level!Describe the solution you'd like
encoding
. These contain amod.ts
for the main logic (basically, what most of the submodules have in their top entry point), test files, util and wasm files/subdirectories.This ensures that all needed data and files for a submodule are grouped inside one directory and can be expanded by adding files inside the directory if necessary.
This will ensure that import will not break as it will forward the same data.
new structure
toml
varint
This is a big structural change, but worth it, because it introduces a functioning system for future additions and will get harder to fix over time.
Describe alternatives you've considered
keeping the file structure as-is
The more features and modules are introduced, the more messy it will get.
testdata
will contain a lot of unrelated files from different submodules. If more submodules are introduced that need a wasm directory, it will bloat top levelstd
.The text was updated successfully, but these errors were encountered: