skill-universe 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/bin/skillc.mjs +3 -0
- package/build/dev/javascript/argv/_gleam_artefacts/argv.cache +0 -0
- package/build/dev/javascript/argv/_gleam_artefacts/argv.cache_inline +0 -0
- package/build/dev/javascript/argv/_gleam_artefacts/argv.cache_meta +0 -0
- package/build/dev/javascript/argv/argv.erl +12 -0
- package/build/dev/javascript/argv/argv.mjs +31 -0
- package/build/dev/javascript/argv/argv_ffi.erl +27 -0
- package/build/dev/javascript/argv/argv_ffi.mjs +20 -0
- package/build/dev/javascript/argv/gleam.mjs +1 -0
- package/build/dev/javascript/filepath/_gleam_artefacts/filepath.cache +0 -0
- package/build/dev/javascript/filepath/_gleam_artefacts/filepath.cache_inline +0 -0
- package/build/dev/javascript/filepath/_gleam_artefacts/filepath.cache_meta +0 -0
- package/build/dev/javascript/filepath/filepath.erl +425 -0
- package/build/dev/javascript/filepath/filepath.mjs +529 -0
- package/build/dev/javascript/filepath/filepath_ffi.erl +9 -0
- package/build/dev/javascript/filepath/filepath_ffi.mjs +6 -0
- package/build/dev/javascript/filepath/gleam.mjs +1 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_inline +0 -0
- package/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_meta +0 -0
- package/build/dev/javascript/gleam_stdlib/dict.mjs +710 -0
- package/build/dev/javascript/gleam_stdlib/gleam/bit_array.mjs +285 -0
- package/build/dev/javascript/gleam_stdlib/gleam/bool.mjs +313 -0
- package/build/dev/javascript/gleam_stdlib/gleam/bytes_tree.mjs +225 -0
- package/build/dev/javascript/gleam_stdlib/gleam/dict.mjs +456 -0
- package/build/dev/javascript/gleam_stdlib/gleam/dynamic/decode.mjs +985 -0
- package/build/dev/javascript/gleam_stdlib/gleam/dynamic.mjs +35 -0
- package/build/dev/javascript/gleam_stdlib/gleam/float.mjs +572 -0
- package/build/dev/javascript/gleam_stdlib/gleam/function.mjs +6 -0
- package/build/dev/javascript/gleam_stdlib/gleam/int.mjs +832 -0
- package/build/dev/javascript/gleam_stdlib/gleam/io.mjs +8 -0
- package/build/dev/javascript/gleam_stdlib/gleam/list.mjs +3160 -0
- package/build/dev/javascript/gleam_stdlib/gleam/option.mjs +418 -0
- package/build/dev/javascript/gleam_stdlib/gleam/order.mjs +178 -0
- package/build/dev/javascript/gleam_stdlib/gleam/pair.mjs +102 -0
- package/build/dev/javascript/gleam_stdlib/gleam/result.mjs +480 -0
- package/build/dev/javascript/gleam_stdlib/gleam/set.mjs +416 -0
- package/build/dev/javascript/gleam_stdlib/gleam/string.mjs +723 -0
- package/build/dev/javascript/gleam_stdlib/gleam/string_tree.mjs +133 -0
- package/build/dev/javascript/gleam_stdlib/gleam/uri.mjs +1155 -0
- package/build/dev/javascript/gleam_stdlib/gleam.mjs +1 -0
- package/build/dev/javascript/gleam_stdlib/gleam@bit_array.erl +347 -0
- package/build/dev/javascript/gleam_stdlib/gleam@bool.erl +352 -0
- package/build/dev/javascript/gleam_stdlib/gleam@bytes_tree.erl +211 -0
- package/build/dev/javascript/gleam_stdlib/gleam@dict.erl +521 -0
- package/build/dev/javascript/gleam_stdlib/gleam@dynamic.erl +106 -0
- package/build/dev/javascript/gleam_stdlib/gleam@dynamic@decode.erl +1112 -0
- package/build/dev/javascript/gleam_stdlib/gleam@float.erl +764 -0
- package/build/dev/javascript/gleam_stdlib/gleam@function.erl +18 -0
- package/build/dev/javascript/gleam_stdlib/gleam@int.erl +1004 -0
- package/build/dev/javascript/gleam_stdlib/gleam@io.erl +80 -0
- package/build/dev/javascript/gleam_stdlib/gleam@list.erl +2832 -0
- package/build/dev/javascript/gleam_stdlib/gleam@option.erl +413 -0
- package/build/dev/javascript/gleam_stdlib/gleam@order.erl +200 -0
- package/build/dev/javascript/gleam_stdlib/gleam@pair.erl +110 -0
- package/build/dev/javascript/gleam_stdlib/gleam@result.erl +532 -0
- package/build/dev/javascript/gleam_stdlib/gleam@set.erl +433 -0
- package/build/dev/javascript/gleam_stdlib/gleam@string.erl +1012 -0
- package/build/dev/javascript/gleam_stdlib/gleam@string_tree.erl +207 -0
- package/build/dev/javascript/gleam_stdlib/gleam@uri.erl +1049 -0
- package/build/dev/javascript/gleam_stdlib/gleam_stdlib.erl +529 -0
- package/build/dev/javascript/gleam_stdlib/gleam_stdlib.mjs +1050 -0
- package/build/dev/javascript/gleam_version +1 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@gleam_panic.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@gleam_panic.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@gleam_panic.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@reporting.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@reporting.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@internal@reporting.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@should.cache +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@should.cache_inline +0 -0
- package/build/dev/javascript/gleeunit/_gleam_artefacts/gleeunit@should.cache_meta +0 -0
- package/build/dev/javascript/gleeunit/gleam.mjs +1 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/gleam_panic.mjs +180 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/gleeunit_gleam_panic_ffi.erl +49 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/gleeunit_gleam_panic_ffi.mjs +91 -0
- package/build/dev/javascript/gleeunit/gleeunit/internal/reporting.mjs +256 -0
- package/build/dev/javascript/gleeunit/gleeunit/should.mjs +135 -0
- package/build/dev/javascript/gleeunit/gleeunit.erl +89 -0
- package/build/dev/javascript/gleeunit/gleeunit.mjs +62 -0
- package/build/dev/javascript/gleeunit/gleeunit@internal@gleam_panic.erl +56 -0
- package/build/dev/javascript/gleeunit/gleeunit@internal@reporting.erl +343 -0
- package/build/dev/javascript/gleeunit/gleeunit@should.erl +153 -0
- package/build/dev/javascript/gleeunit/gleeunit_ffi.erl +21 -0
- package/build/dev/javascript/gleeunit/gleeunit_ffi.mjs +100 -0
- package/build/dev/javascript/gleeunit/gleeunit_progress.erl +72 -0
- package/build/dev/javascript/prelude.mjs +1575 -0
- package/build/dev/javascript/simplifile/_gleam_artefacts/simplifile.cache +0 -0
- package/build/dev/javascript/simplifile/_gleam_artefacts/simplifile.cache_inline +0 -0
- package/build/dev/javascript/simplifile/_gleam_artefacts/simplifile.cache_meta +0 -0
- package/build/dev/javascript/simplifile/gleam.mjs +1 -0
- package/build/dev/javascript/simplifile/simplifile.erl +893 -0
- package/build/dev/javascript/simplifile/simplifile.mjs +893 -0
- package/build/dev/javascript/simplifile/simplifile_erl.erl +244 -0
- package/build/dev/javascript/simplifile/simplifile_js.mjs +400 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/cli_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/compiler_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/config_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/importer_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/parser_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/path_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/provider_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/registry_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/scaffold_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@compiler.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@config.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@error.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@fs.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@importer.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@parser.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@path.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@platform.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@provider.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@registry.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@scaffold.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@semver.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@shell.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@template.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@types.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@version_constraint.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc@yaml.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/skillc_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/template_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache_inline +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache_meta +0 -0
- package/build/dev/javascript/skillc/_gleam_artefacts/version_constraint_test.cache_warnings +0 -0
- package/build/dev/javascript/skillc/cli_test.mjs +461 -0
- package/build/dev/javascript/skillc/compiler_test.mjs +3089 -0
- package/build/dev/javascript/skillc/config_test.mjs +308 -0
- package/build/dev/javascript/skillc/gleam.main.mjs +2 -0
- package/build/dev/javascript/skillc/gleam.mjs +1 -0
- package/build/dev/javascript/skillc/importer_test.mjs +1643 -0
- package/build/dev/javascript/skillc/parser_test.mjs +1601 -0
- package/build/dev/javascript/skillc/path_test.mjs +26 -0
- package/build/dev/javascript/skillc/provider_test.mjs +221 -0
- package/build/dev/javascript/skillc/registry_test.mjs +359 -0
- package/build/dev/javascript/skillc/scaffold_test.mjs +405 -0
- package/build/dev/javascript/skillc/skillc/compiler.mjs +724 -0
- package/build/dev/javascript/skillc/skillc/config.mjs +172 -0
- package/build/dev/javascript/skillc/skillc/error.mjs +145 -0
- package/build/dev/javascript/skillc/skillc/fs.mjs +40 -0
- package/build/dev/javascript/skillc/skillc/importer.mjs +975 -0
- package/build/dev/javascript/skillc/skillc/parser.mjs +427 -0
- package/build/dev/javascript/skillc/skillc/path.mjs +52 -0
- package/build/dev/javascript/skillc/skillc/platform.mjs +44 -0
- package/build/dev/javascript/skillc/skillc/provider.mjs +86 -0
- package/build/dev/javascript/skillc/skillc/registry.mjs +701 -0
- package/build/dev/javascript/skillc/skillc/scaffold.mjs +117 -0
- package/build/dev/javascript/skillc/skillc/semver.mjs +293 -0
- package/build/dev/javascript/skillc/skillc/shell.mjs +14 -0
- package/build/dev/javascript/skillc/skillc/template.mjs +1177 -0
- package/build/dev/javascript/skillc/skillc/types.mjs +249 -0
- package/build/dev/javascript/skillc/skillc/version_constraint.mjs +290 -0
- package/build/dev/javascript/skillc/skillc/yaml.mjs +51 -0
- package/build/dev/javascript/skillc/skillc.mjs +873 -0
- package/build/dev/javascript/skillc/skillc_ffi.mjs +30 -0
- package/build/dev/javascript/skillc/skillc_test.mjs +5 -0
- package/build/dev/javascript/skillc/template_test.mjs +1638 -0
- package/build/dev/javascript/skillc/version_constraint_test.mjs +1325 -0
- package/build/dev/javascript/yay/_gleam_artefacts/yay.cache +0 -0
- package/build/dev/javascript/yay/_gleam_artefacts/yay.cache_inline +0 -0
- package/build/dev/javascript/yay/_gleam_artefacts/yay.cache_meta +0 -0
- package/build/dev/javascript/yay/gleam.mjs +1 -0
- package/build/dev/javascript/yay/yaml_ffi.erl +106 -0
- package/build/dev/javascript/yay/yaml_ffi.mjs +373 -0
- package/build/dev/javascript/yay/yay.erl +1218 -0
- package/build/dev/javascript/yay/yay.mjs +1403 -0
- package/package.json +28 -0
- package/src/skillc/compiler.gleam +561 -0
- package/src/skillc/config.gleam +91 -0
- package/src/skillc/error.gleam +37 -0
- package/src/skillc/fs.gleam +31 -0
- package/src/skillc/importer.gleam +709 -0
- package/src/skillc/parser.gleam +279 -0
- package/src/skillc/path.gleam +30 -0
- package/src/skillc/platform.gleam +25 -0
- package/src/skillc/provider.gleam +58 -0
- package/src/skillc/registry.gleam +472 -0
- package/src/skillc/scaffold.gleam +112 -0
- package/src/skillc/semver.gleam +165 -0
- package/src/skillc/shell.gleam +12 -0
- package/src/skillc/template.gleam +885 -0
- package/src/skillc/types.gleam +93 -0
- package/src/skillc/version_constraint.gleam +163 -0
- package/src/skillc/yaml.gleam +27 -0
- package/src/skillc.gleam +466 -0
- package/src/skillc_ffi.mjs +30 -0
|
@@ -0,0 +1,893 @@
|
|
|
1
|
+
import * as $filepath from "../filepath/filepath.mjs";
|
|
2
|
+
import * as $bit_array from "../gleam_stdlib/gleam/bit_array.mjs";
|
|
3
|
+
import * as $int from "../gleam_stdlib/gleam/int.mjs";
|
|
4
|
+
import * as $list from "../gleam_stdlib/gleam/list.mjs";
|
|
5
|
+
import * as $result from "../gleam_stdlib/gleam/result.mjs";
|
|
6
|
+
import * as $set from "../gleam_stdlib/gleam/set.mjs";
|
|
7
|
+
import * as $string from "../gleam_stdlib/gleam/string.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Ok,
|
|
10
|
+
Error,
|
|
11
|
+
toList,
|
|
12
|
+
Empty as $Empty,
|
|
13
|
+
prepend as listPrepend,
|
|
14
|
+
CustomType as $CustomType,
|
|
15
|
+
makeError,
|
|
16
|
+
toBitArray,
|
|
17
|
+
} from "./gleam.mjs";
|
|
18
|
+
import {
|
|
19
|
+
fileInfo as file_info,
|
|
20
|
+
linkInfo as link_info,
|
|
21
|
+
delete_ as delete$,
|
|
22
|
+
readBits as read_bits,
|
|
23
|
+
writeBits as write_bits,
|
|
24
|
+
appendBits as append_bits,
|
|
25
|
+
isDirectory as is_directory,
|
|
26
|
+
createDirectory as create_directory,
|
|
27
|
+
createSymlink as create_symlink,
|
|
28
|
+
createLink as create_link,
|
|
29
|
+
readDirectory as read_directory,
|
|
30
|
+
isFile as is_file,
|
|
31
|
+
isSymlink as is_symlink,
|
|
32
|
+
createDirAll as do_create_dir_all,
|
|
33
|
+
copyFile as do_copy_file,
|
|
34
|
+
renameFile as rename_file,
|
|
35
|
+
renameFile as rename,
|
|
36
|
+
setPermissionsOctal as set_permissions_octal,
|
|
37
|
+
currentDirectory as current_directory,
|
|
38
|
+
} from "./simplifile_js.mjs";
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
append_bits,
|
|
42
|
+
create_directory,
|
|
43
|
+
create_link,
|
|
44
|
+
create_symlink,
|
|
45
|
+
current_directory,
|
|
46
|
+
delete$,
|
|
47
|
+
file_info,
|
|
48
|
+
is_directory,
|
|
49
|
+
is_file,
|
|
50
|
+
is_symlink,
|
|
51
|
+
link_info,
|
|
52
|
+
read_bits,
|
|
53
|
+
read_directory,
|
|
54
|
+
rename,
|
|
55
|
+
rename_file,
|
|
56
|
+
set_permissions_octal,
|
|
57
|
+
write_bits,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const FILEPATH = "src/simplifile.gleam";
|
|
61
|
+
|
|
62
|
+
export class Eacces extends $CustomType {}
|
|
63
|
+
export const FileError$Eacces = () => new Eacces();
|
|
64
|
+
export const FileError$isEacces = (value) => value instanceof Eacces;
|
|
65
|
+
|
|
66
|
+
export class Eagain extends $CustomType {}
|
|
67
|
+
export const FileError$Eagain = () => new Eagain();
|
|
68
|
+
export const FileError$isEagain = (value) => value instanceof Eagain;
|
|
69
|
+
|
|
70
|
+
export class Ebadf extends $CustomType {}
|
|
71
|
+
export const FileError$Ebadf = () => new Ebadf();
|
|
72
|
+
export const FileError$isEbadf = (value) => value instanceof Ebadf;
|
|
73
|
+
|
|
74
|
+
export class Ebadmsg extends $CustomType {}
|
|
75
|
+
export const FileError$Ebadmsg = () => new Ebadmsg();
|
|
76
|
+
export const FileError$isEbadmsg = (value) => value instanceof Ebadmsg;
|
|
77
|
+
|
|
78
|
+
export class Ebusy extends $CustomType {}
|
|
79
|
+
export const FileError$Ebusy = () => new Ebusy();
|
|
80
|
+
export const FileError$isEbusy = (value) => value instanceof Ebusy;
|
|
81
|
+
|
|
82
|
+
export class Edeadlk extends $CustomType {}
|
|
83
|
+
export const FileError$Edeadlk = () => new Edeadlk();
|
|
84
|
+
export const FileError$isEdeadlk = (value) => value instanceof Edeadlk;
|
|
85
|
+
|
|
86
|
+
export class Edeadlock extends $CustomType {}
|
|
87
|
+
export const FileError$Edeadlock = () => new Edeadlock();
|
|
88
|
+
export const FileError$isEdeadlock = (value) => value instanceof Edeadlock;
|
|
89
|
+
|
|
90
|
+
export class Edquot extends $CustomType {}
|
|
91
|
+
export const FileError$Edquot = () => new Edquot();
|
|
92
|
+
export const FileError$isEdquot = (value) => value instanceof Edquot;
|
|
93
|
+
|
|
94
|
+
export class Eexist extends $CustomType {}
|
|
95
|
+
export const FileError$Eexist = () => new Eexist();
|
|
96
|
+
export const FileError$isEexist = (value) => value instanceof Eexist;
|
|
97
|
+
|
|
98
|
+
export class Efault extends $CustomType {}
|
|
99
|
+
export const FileError$Efault = () => new Efault();
|
|
100
|
+
export const FileError$isEfault = (value) => value instanceof Efault;
|
|
101
|
+
|
|
102
|
+
export class Efbig extends $CustomType {}
|
|
103
|
+
export const FileError$Efbig = () => new Efbig();
|
|
104
|
+
export const FileError$isEfbig = (value) => value instanceof Efbig;
|
|
105
|
+
|
|
106
|
+
export class Eftype extends $CustomType {}
|
|
107
|
+
export const FileError$Eftype = () => new Eftype();
|
|
108
|
+
export const FileError$isEftype = (value) => value instanceof Eftype;
|
|
109
|
+
|
|
110
|
+
export class Eintr extends $CustomType {}
|
|
111
|
+
export const FileError$Eintr = () => new Eintr();
|
|
112
|
+
export const FileError$isEintr = (value) => value instanceof Eintr;
|
|
113
|
+
|
|
114
|
+
export class Einval extends $CustomType {}
|
|
115
|
+
export const FileError$Einval = () => new Einval();
|
|
116
|
+
export const FileError$isEinval = (value) => value instanceof Einval;
|
|
117
|
+
|
|
118
|
+
export class Eio extends $CustomType {}
|
|
119
|
+
export const FileError$Eio = () => new Eio();
|
|
120
|
+
export const FileError$isEio = (value) => value instanceof Eio;
|
|
121
|
+
|
|
122
|
+
export class Eisdir extends $CustomType {}
|
|
123
|
+
export const FileError$Eisdir = () => new Eisdir();
|
|
124
|
+
export const FileError$isEisdir = (value) => value instanceof Eisdir;
|
|
125
|
+
|
|
126
|
+
export class Eloop extends $CustomType {}
|
|
127
|
+
export const FileError$Eloop = () => new Eloop();
|
|
128
|
+
export const FileError$isEloop = (value) => value instanceof Eloop;
|
|
129
|
+
|
|
130
|
+
export class Emfile extends $CustomType {}
|
|
131
|
+
export const FileError$Emfile = () => new Emfile();
|
|
132
|
+
export const FileError$isEmfile = (value) => value instanceof Emfile;
|
|
133
|
+
|
|
134
|
+
export class Emlink extends $CustomType {}
|
|
135
|
+
export const FileError$Emlink = () => new Emlink();
|
|
136
|
+
export const FileError$isEmlink = (value) => value instanceof Emlink;
|
|
137
|
+
|
|
138
|
+
export class Emultihop extends $CustomType {}
|
|
139
|
+
export const FileError$Emultihop = () => new Emultihop();
|
|
140
|
+
export const FileError$isEmultihop = (value) => value instanceof Emultihop;
|
|
141
|
+
|
|
142
|
+
export class Enametoolong extends $CustomType {}
|
|
143
|
+
export const FileError$Enametoolong = () => new Enametoolong();
|
|
144
|
+
export const FileError$isEnametoolong = (value) =>
|
|
145
|
+
value instanceof Enametoolong;
|
|
146
|
+
|
|
147
|
+
export class Enfile extends $CustomType {}
|
|
148
|
+
export const FileError$Enfile = () => new Enfile();
|
|
149
|
+
export const FileError$isEnfile = (value) => value instanceof Enfile;
|
|
150
|
+
|
|
151
|
+
export class Enobufs extends $CustomType {}
|
|
152
|
+
export const FileError$Enobufs = () => new Enobufs();
|
|
153
|
+
export const FileError$isEnobufs = (value) => value instanceof Enobufs;
|
|
154
|
+
|
|
155
|
+
export class Enodev extends $CustomType {}
|
|
156
|
+
export const FileError$Enodev = () => new Enodev();
|
|
157
|
+
export const FileError$isEnodev = (value) => value instanceof Enodev;
|
|
158
|
+
|
|
159
|
+
export class Enolck extends $CustomType {}
|
|
160
|
+
export const FileError$Enolck = () => new Enolck();
|
|
161
|
+
export const FileError$isEnolck = (value) => value instanceof Enolck;
|
|
162
|
+
|
|
163
|
+
export class Enolink extends $CustomType {}
|
|
164
|
+
export const FileError$Enolink = () => new Enolink();
|
|
165
|
+
export const FileError$isEnolink = (value) => value instanceof Enolink;
|
|
166
|
+
|
|
167
|
+
export class Enoent extends $CustomType {}
|
|
168
|
+
export const FileError$Enoent = () => new Enoent();
|
|
169
|
+
export const FileError$isEnoent = (value) => value instanceof Enoent;
|
|
170
|
+
|
|
171
|
+
export class Enomem extends $CustomType {}
|
|
172
|
+
export const FileError$Enomem = () => new Enomem();
|
|
173
|
+
export const FileError$isEnomem = (value) => value instanceof Enomem;
|
|
174
|
+
|
|
175
|
+
export class Enospc extends $CustomType {}
|
|
176
|
+
export const FileError$Enospc = () => new Enospc();
|
|
177
|
+
export const FileError$isEnospc = (value) => value instanceof Enospc;
|
|
178
|
+
|
|
179
|
+
export class Enosr extends $CustomType {}
|
|
180
|
+
export const FileError$Enosr = () => new Enosr();
|
|
181
|
+
export const FileError$isEnosr = (value) => value instanceof Enosr;
|
|
182
|
+
|
|
183
|
+
export class Enostr extends $CustomType {}
|
|
184
|
+
export const FileError$Enostr = () => new Enostr();
|
|
185
|
+
export const FileError$isEnostr = (value) => value instanceof Enostr;
|
|
186
|
+
|
|
187
|
+
export class Enosys extends $CustomType {}
|
|
188
|
+
export const FileError$Enosys = () => new Enosys();
|
|
189
|
+
export const FileError$isEnosys = (value) => value instanceof Enosys;
|
|
190
|
+
|
|
191
|
+
export class Enotblk extends $CustomType {}
|
|
192
|
+
export const FileError$Enotblk = () => new Enotblk();
|
|
193
|
+
export const FileError$isEnotblk = (value) => value instanceof Enotblk;
|
|
194
|
+
|
|
195
|
+
export class Enotdir extends $CustomType {}
|
|
196
|
+
export const FileError$Enotdir = () => new Enotdir();
|
|
197
|
+
export const FileError$isEnotdir = (value) => value instanceof Enotdir;
|
|
198
|
+
|
|
199
|
+
export class Enotsup extends $CustomType {}
|
|
200
|
+
export const FileError$Enotsup = () => new Enotsup();
|
|
201
|
+
export const FileError$isEnotsup = (value) => value instanceof Enotsup;
|
|
202
|
+
|
|
203
|
+
export class Enxio extends $CustomType {}
|
|
204
|
+
export const FileError$Enxio = () => new Enxio();
|
|
205
|
+
export const FileError$isEnxio = (value) => value instanceof Enxio;
|
|
206
|
+
|
|
207
|
+
export class Eopnotsupp extends $CustomType {}
|
|
208
|
+
export const FileError$Eopnotsupp = () => new Eopnotsupp();
|
|
209
|
+
export const FileError$isEopnotsupp = (value) => value instanceof Eopnotsupp;
|
|
210
|
+
|
|
211
|
+
export class Eoverflow extends $CustomType {}
|
|
212
|
+
export const FileError$Eoverflow = () => new Eoverflow();
|
|
213
|
+
export const FileError$isEoverflow = (value) => value instanceof Eoverflow;
|
|
214
|
+
|
|
215
|
+
export class Eperm extends $CustomType {}
|
|
216
|
+
export const FileError$Eperm = () => new Eperm();
|
|
217
|
+
export const FileError$isEperm = (value) => value instanceof Eperm;
|
|
218
|
+
|
|
219
|
+
export class Epipe extends $CustomType {}
|
|
220
|
+
export const FileError$Epipe = () => new Epipe();
|
|
221
|
+
export const FileError$isEpipe = (value) => value instanceof Epipe;
|
|
222
|
+
|
|
223
|
+
export class Erange extends $CustomType {}
|
|
224
|
+
export const FileError$Erange = () => new Erange();
|
|
225
|
+
export const FileError$isErange = (value) => value instanceof Erange;
|
|
226
|
+
|
|
227
|
+
export class Erofs extends $CustomType {}
|
|
228
|
+
export const FileError$Erofs = () => new Erofs();
|
|
229
|
+
export const FileError$isErofs = (value) => value instanceof Erofs;
|
|
230
|
+
|
|
231
|
+
export class Espipe extends $CustomType {}
|
|
232
|
+
export const FileError$Espipe = () => new Espipe();
|
|
233
|
+
export const FileError$isEspipe = (value) => value instanceof Espipe;
|
|
234
|
+
|
|
235
|
+
export class Esrch extends $CustomType {}
|
|
236
|
+
export const FileError$Esrch = () => new Esrch();
|
|
237
|
+
export const FileError$isEsrch = (value) => value instanceof Esrch;
|
|
238
|
+
|
|
239
|
+
export class Estale extends $CustomType {}
|
|
240
|
+
export const FileError$Estale = () => new Estale();
|
|
241
|
+
export const FileError$isEstale = (value) => value instanceof Estale;
|
|
242
|
+
|
|
243
|
+
export class Etxtbsy extends $CustomType {}
|
|
244
|
+
export const FileError$Etxtbsy = () => new Etxtbsy();
|
|
245
|
+
export const FileError$isEtxtbsy = (value) => value instanceof Etxtbsy;
|
|
246
|
+
|
|
247
|
+
export class Exdev extends $CustomType {}
|
|
248
|
+
export const FileError$Exdev = () => new Exdev();
|
|
249
|
+
export const FileError$isExdev = (value) => value instanceof Exdev;
|
|
250
|
+
|
|
251
|
+
export class NotUtf8 extends $CustomType {}
|
|
252
|
+
export const FileError$NotUtf8 = () => new NotUtf8();
|
|
253
|
+
export const FileError$isNotUtf8 = (value) => value instanceof NotUtf8;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Any error not accounted for by this type
|
|
257
|
+
*/
|
|
258
|
+
export class Unknown extends $CustomType {
|
|
259
|
+
constructor(inner) {
|
|
260
|
+
super();
|
|
261
|
+
this.inner = inner;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
export const FileError$Unknown = (inner) => new Unknown(inner);
|
|
265
|
+
export const FileError$isUnknown = (value) => value instanceof Unknown;
|
|
266
|
+
export const FileError$Unknown$inner = (value) => value.inner;
|
|
267
|
+
export const FileError$Unknown$0 = (value) => value.inner;
|
|
268
|
+
|
|
269
|
+
export class FileInfo extends $CustomType {
|
|
270
|
+
constructor(size, mode, nlinks, inode, user_id, group_id, dev, atime_seconds, mtime_seconds, ctime_seconds) {
|
|
271
|
+
super();
|
|
272
|
+
this.size = size;
|
|
273
|
+
this.mode = mode;
|
|
274
|
+
this.nlinks = nlinks;
|
|
275
|
+
this.inode = inode;
|
|
276
|
+
this.user_id = user_id;
|
|
277
|
+
this.group_id = group_id;
|
|
278
|
+
this.dev = dev;
|
|
279
|
+
this.atime_seconds = atime_seconds;
|
|
280
|
+
this.mtime_seconds = mtime_seconds;
|
|
281
|
+
this.ctime_seconds = ctime_seconds;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
export const FileInfo$FileInfo = (size, mode, nlinks, inode, user_id, group_id, dev, atime_seconds, mtime_seconds, ctime_seconds) =>
|
|
285
|
+
new FileInfo(size,
|
|
286
|
+
mode,
|
|
287
|
+
nlinks,
|
|
288
|
+
inode,
|
|
289
|
+
user_id,
|
|
290
|
+
group_id,
|
|
291
|
+
dev,
|
|
292
|
+
atime_seconds,
|
|
293
|
+
mtime_seconds,
|
|
294
|
+
ctime_seconds);
|
|
295
|
+
export const FileInfo$isFileInfo = (value) => value instanceof FileInfo;
|
|
296
|
+
export const FileInfo$FileInfo$size = (value) => value.size;
|
|
297
|
+
export const FileInfo$FileInfo$0 = (value) => value.size;
|
|
298
|
+
export const FileInfo$FileInfo$mode = (value) => value.mode;
|
|
299
|
+
export const FileInfo$FileInfo$1 = (value) => value.mode;
|
|
300
|
+
export const FileInfo$FileInfo$nlinks = (value) => value.nlinks;
|
|
301
|
+
export const FileInfo$FileInfo$2 = (value) => value.nlinks;
|
|
302
|
+
export const FileInfo$FileInfo$inode = (value) => value.inode;
|
|
303
|
+
export const FileInfo$FileInfo$3 = (value) => value.inode;
|
|
304
|
+
export const FileInfo$FileInfo$user_id = (value) => value.user_id;
|
|
305
|
+
export const FileInfo$FileInfo$4 = (value) => value.user_id;
|
|
306
|
+
export const FileInfo$FileInfo$group_id = (value) => value.group_id;
|
|
307
|
+
export const FileInfo$FileInfo$5 = (value) => value.group_id;
|
|
308
|
+
export const FileInfo$FileInfo$dev = (value) => value.dev;
|
|
309
|
+
export const FileInfo$FileInfo$6 = (value) => value.dev;
|
|
310
|
+
export const FileInfo$FileInfo$atime_seconds = (value) => value.atime_seconds;
|
|
311
|
+
export const FileInfo$FileInfo$7 = (value) => value.atime_seconds;
|
|
312
|
+
export const FileInfo$FileInfo$mtime_seconds = (value) => value.mtime_seconds;
|
|
313
|
+
export const FileInfo$FileInfo$8 = (value) => value.mtime_seconds;
|
|
314
|
+
export const FileInfo$FileInfo$ctime_seconds = (value) => value.ctime_seconds;
|
|
315
|
+
export const FileInfo$FileInfo$9 = (value) => value.ctime_seconds;
|
|
316
|
+
|
|
317
|
+
export class File extends $CustomType {}
|
|
318
|
+
export const FileType$File = () => new File();
|
|
319
|
+
export const FileType$isFile = (value) => value instanceof File;
|
|
320
|
+
|
|
321
|
+
export class Directory extends $CustomType {}
|
|
322
|
+
export const FileType$Directory = () => new Directory();
|
|
323
|
+
export const FileType$isDirectory = (value) => value instanceof Directory;
|
|
324
|
+
|
|
325
|
+
export class Symlink extends $CustomType {}
|
|
326
|
+
export const FileType$Symlink = () => new Symlink();
|
|
327
|
+
export const FileType$isSymlink = (value) => value instanceof Symlink;
|
|
328
|
+
|
|
329
|
+
export class Other extends $CustomType {}
|
|
330
|
+
export const FileType$Other = () => new Other();
|
|
331
|
+
export const FileType$isOther = (value) => value instanceof Other;
|
|
332
|
+
|
|
333
|
+
export class Read extends $CustomType {}
|
|
334
|
+
export const Permission$Read = () => new Read();
|
|
335
|
+
export const Permission$isRead = (value) => value instanceof Read;
|
|
336
|
+
|
|
337
|
+
export class Write extends $CustomType {}
|
|
338
|
+
export const Permission$Write = () => new Write();
|
|
339
|
+
export const Permission$isWrite = (value) => value instanceof Write;
|
|
340
|
+
|
|
341
|
+
export class Execute extends $CustomType {}
|
|
342
|
+
export const Permission$Execute = () => new Execute();
|
|
343
|
+
export const Permission$isExecute = (value) => value instanceof Execute;
|
|
344
|
+
|
|
345
|
+
export class FilePermissions extends $CustomType {
|
|
346
|
+
constructor(user, group, other) {
|
|
347
|
+
super();
|
|
348
|
+
this.user = user;
|
|
349
|
+
this.group = group;
|
|
350
|
+
this.other = other;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
export const FilePermissions$FilePermissions = (user, group, other) =>
|
|
354
|
+
new FilePermissions(user, group, other);
|
|
355
|
+
export const FilePermissions$isFilePermissions = (value) =>
|
|
356
|
+
value instanceof FilePermissions;
|
|
357
|
+
export const FilePermissions$FilePermissions$user = (value) => value.user;
|
|
358
|
+
export const FilePermissions$FilePermissions$0 = (value) => value.user;
|
|
359
|
+
export const FilePermissions$FilePermissions$group = (value) => value.group;
|
|
360
|
+
export const FilePermissions$FilePermissions$1 = (value) => value.group;
|
|
361
|
+
export const FilePermissions$FilePermissions$other = (value) => value.other;
|
|
362
|
+
export const FilePermissions$FilePermissions$2 = (value) => value.other;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Convert an error into a human-readable description
|
|
366
|
+
* ## Example
|
|
367
|
+
* ```gleam
|
|
368
|
+
* let assert "Input/output error" = describe_error(Eio)
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
export function describe_error(error) {
|
|
372
|
+
if (error instanceof Eacces) {
|
|
373
|
+
return "Permission denied";
|
|
374
|
+
} else if (error instanceof Eagain) {
|
|
375
|
+
return "Resource temporarily unavailable";
|
|
376
|
+
} else if (error instanceof Ebadf) {
|
|
377
|
+
return "Bad file descriptor";
|
|
378
|
+
} else if (error instanceof Ebadmsg) {
|
|
379
|
+
return "Bad message";
|
|
380
|
+
} else if (error instanceof Ebusy) {
|
|
381
|
+
return "Resource busy";
|
|
382
|
+
} else if (error instanceof Edeadlk) {
|
|
383
|
+
return "Resource deadlock avoided";
|
|
384
|
+
} else if (error instanceof Edeadlock) {
|
|
385
|
+
return "Resource deadlock avoided";
|
|
386
|
+
} else if (error instanceof Edquot) {
|
|
387
|
+
return "Disc quota exceeded";
|
|
388
|
+
} else if (error instanceof Eexist) {
|
|
389
|
+
return "File exists";
|
|
390
|
+
} else if (error instanceof Efault) {
|
|
391
|
+
return "Bad address";
|
|
392
|
+
} else if (error instanceof Efbig) {
|
|
393
|
+
return "File too large";
|
|
394
|
+
} else if (error instanceof Eftype) {
|
|
395
|
+
return "Inappropriate file type or format";
|
|
396
|
+
} else if (error instanceof Eintr) {
|
|
397
|
+
return "Interrupted system call";
|
|
398
|
+
} else if (error instanceof Einval) {
|
|
399
|
+
return "Invalid argument";
|
|
400
|
+
} else if (error instanceof Eio) {
|
|
401
|
+
return "Input/output error";
|
|
402
|
+
} else if (error instanceof Eisdir) {
|
|
403
|
+
return "Is a directory";
|
|
404
|
+
} else if (error instanceof Eloop) {
|
|
405
|
+
return "Too many levels of symbolic links";
|
|
406
|
+
} else if (error instanceof Emfile) {
|
|
407
|
+
return "Too many open files";
|
|
408
|
+
} else if (error instanceof Emlink) {
|
|
409
|
+
return "Too many links";
|
|
410
|
+
} else if (error instanceof Emultihop) {
|
|
411
|
+
return "Multihop attempted";
|
|
412
|
+
} else if (error instanceof Enametoolong) {
|
|
413
|
+
return "File name too long";
|
|
414
|
+
} else if (error instanceof Enfile) {
|
|
415
|
+
return "Too many open files in system";
|
|
416
|
+
} else if (error instanceof Enobufs) {
|
|
417
|
+
return "No buffer space available";
|
|
418
|
+
} else if (error instanceof Enodev) {
|
|
419
|
+
return "Operation not supported by device";
|
|
420
|
+
} else if (error instanceof Enolck) {
|
|
421
|
+
return "No locks available";
|
|
422
|
+
} else if (error instanceof Enolink) {
|
|
423
|
+
return "Link has been severed";
|
|
424
|
+
} else if (error instanceof Enoent) {
|
|
425
|
+
return "No such file or directory";
|
|
426
|
+
} else if (error instanceof Enomem) {
|
|
427
|
+
return "Cannot allocate memory";
|
|
428
|
+
} else if (error instanceof Enospc) {
|
|
429
|
+
return "No space left on device";
|
|
430
|
+
} else if (error instanceof Enosr) {
|
|
431
|
+
return "No STREAM resources";
|
|
432
|
+
} else if (error instanceof Enostr) {
|
|
433
|
+
return "Not a STREAM";
|
|
434
|
+
} else if (error instanceof Enosys) {
|
|
435
|
+
return "Function not implemented";
|
|
436
|
+
} else if (error instanceof Enotblk) {
|
|
437
|
+
return "Block device required";
|
|
438
|
+
} else if (error instanceof Enotdir) {
|
|
439
|
+
return "Not a directory";
|
|
440
|
+
} else if (error instanceof Enotsup) {
|
|
441
|
+
return "Operation not supported";
|
|
442
|
+
} else if (error instanceof Enxio) {
|
|
443
|
+
return "Device not configured";
|
|
444
|
+
} else if (error instanceof Eopnotsupp) {
|
|
445
|
+
return "Operation not supported on socket";
|
|
446
|
+
} else if (error instanceof Eoverflow) {
|
|
447
|
+
return "Value too large to be stored in data type";
|
|
448
|
+
} else if (error instanceof Eperm) {
|
|
449
|
+
return "Operation not permitted";
|
|
450
|
+
} else if (error instanceof Epipe) {
|
|
451
|
+
return "Broken pipe";
|
|
452
|
+
} else if (error instanceof Erange) {
|
|
453
|
+
return "Result too large";
|
|
454
|
+
} else if (error instanceof Erofs) {
|
|
455
|
+
return "Read-only file system";
|
|
456
|
+
} else if (error instanceof Espipe) {
|
|
457
|
+
return "Illegal seek";
|
|
458
|
+
} else if (error instanceof Esrch) {
|
|
459
|
+
return "No such process";
|
|
460
|
+
} else if (error instanceof Estale) {
|
|
461
|
+
return "Stale NFS file handle";
|
|
462
|
+
} else if (error instanceof Etxtbsy) {
|
|
463
|
+
return "Text file busy";
|
|
464
|
+
} else if (error instanceof Exdev) {
|
|
465
|
+
return "Cross-device link";
|
|
466
|
+
} else if (error instanceof NotUtf8) {
|
|
467
|
+
return "File not UTF-8 encoded";
|
|
468
|
+
} else {
|
|
469
|
+
let inner = error.inner;
|
|
470
|
+
return "Unknown error: " + inner;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Extract the file permissions from a given FileInfo value in their octal representation.
|
|
476
|
+
*
|
|
477
|
+
* ## Example
|
|
478
|
+
* ```gleam
|
|
479
|
+
* use info <- result.try(simplifile.file_info("src/app.gleam"))
|
|
480
|
+
* simplifile.file_info_permissions_octal(info)
|
|
481
|
+
* // --> 0o644
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
export function file_info_permissions_octal(file_info) {
|
|
485
|
+
return $int.bitwise_and(file_info.mode, 0o777);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Extract the file type from a given FileInfo value.
|
|
490
|
+
*
|
|
491
|
+
* ## Example
|
|
492
|
+
* ```gleam
|
|
493
|
+
* use info <- result.try(simplifile.file_info("src/app.gleam"))
|
|
494
|
+
* simplifile.file_info_type(info)
|
|
495
|
+
* // --> simplifile.File
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
export function file_info_type(file_info) {
|
|
499
|
+
let $ = $int.bitwise_and(file_info.mode, 0o170000);
|
|
500
|
+
if ($ === 32768) {
|
|
501
|
+
return new File();
|
|
502
|
+
} else if ($ === 16384) {
|
|
503
|
+
return new Directory();
|
|
504
|
+
} else if ($ === 40960) {
|
|
505
|
+
return new Symlink();
|
|
506
|
+
} else {
|
|
507
|
+
return new Other();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Delete all files/directories specified in a list of paths.
|
|
513
|
+
* Recursively deletes provided directories.
|
|
514
|
+
* Does not return an error if one or more of the provided paths
|
|
515
|
+
* do not exist.
|
|
516
|
+
*/
|
|
517
|
+
export function delete_all(loop$paths) {
|
|
518
|
+
while (true) {
|
|
519
|
+
let paths = loop$paths;
|
|
520
|
+
if (paths instanceof $Empty) {
|
|
521
|
+
return new Ok(undefined);
|
|
522
|
+
} else {
|
|
523
|
+
let path = paths.head;
|
|
524
|
+
let rest = paths.tail;
|
|
525
|
+
let $ = delete$(path);
|
|
526
|
+
if ($ instanceof Ok) {
|
|
527
|
+
loop$paths = rest;
|
|
528
|
+
} else {
|
|
529
|
+
let $1 = $[0];
|
|
530
|
+
if ($1 instanceof Enoent) {
|
|
531
|
+
loop$paths = rest;
|
|
532
|
+
} else {
|
|
533
|
+
return $;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Read a files contents as a string
|
|
542
|
+
* ## Example
|
|
543
|
+
* ```gleam
|
|
544
|
+
* let assert Ok(records) = read(from: "./users.csv")
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
export function read(filepath) {
|
|
548
|
+
let $ = read_bits(filepath);
|
|
549
|
+
if ($ instanceof Ok) {
|
|
550
|
+
let bits = $[0];
|
|
551
|
+
let $1 = $bit_array.to_string(bits);
|
|
552
|
+
if ($1 instanceof Ok) {
|
|
553
|
+
return $1;
|
|
554
|
+
} else {
|
|
555
|
+
return new Error(new NotUtf8());
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
return $;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Write a string to a file at the given path
|
|
564
|
+
* ## Example
|
|
565
|
+
* ```gleam
|
|
566
|
+
* let assert Ok(Nil) = write(to: "./hello_world.txt", contents: "Hello, World!")
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
export function write(filepath, contents) {
|
|
570
|
+
let _pipe = contents;
|
|
571
|
+
let _pipe$1 = $bit_array.from_string(_pipe);
|
|
572
|
+
return write_bits(filepath, _pipe$1);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Append a string to the contents of a file at the given path
|
|
577
|
+
* ## Example
|
|
578
|
+
* ```gleam
|
|
579
|
+
* let assert Ok(Nil) = append(to: "./needs_more_text.txt", contents: "more text")
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
export function append(filepath, contents) {
|
|
583
|
+
let _pipe = contents;
|
|
584
|
+
let _pipe$1 = $bit_array.from_string(_pipe);
|
|
585
|
+
return append_bits(filepath, _pipe$1);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Creates an empty file at the given filepath. Returns an `Error(Eexist)`
|
|
590
|
+
* if the file already exists.
|
|
591
|
+
*/
|
|
592
|
+
export function create_file(filepath) {
|
|
593
|
+
let $ = (() => {
|
|
594
|
+
let _pipe = filepath;
|
|
595
|
+
return is_file(_pipe);
|
|
596
|
+
})();
|
|
597
|
+
let $1 = (() => {
|
|
598
|
+
let _pipe = filepath;
|
|
599
|
+
return is_directory(_pipe);
|
|
600
|
+
})();
|
|
601
|
+
if ($ instanceof Ok) {
|
|
602
|
+
let $2 = $[0];
|
|
603
|
+
if ($2) {
|
|
604
|
+
return new Error(new Eexist());
|
|
605
|
+
} else if ($1 instanceof Ok) {
|
|
606
|
+
let $3 = $1[0];
|
|
607
|
+
if ($3) {
|
|
608
|
+
return new Error(new Eexist());
|
|
609
|
+
} else {
|
|
610
|
+
return write_bits(filepath, toBitArray([]));
|
|
611
|
+
}
|
|
612
|
+
} else {
|
|
613
|
+
return write_bits(filepath, toBitArray([]));
|
|
614
|
+
}
|
|
615
|
+
} else if ($1 instanceof Ok) {
|
|
616
|
+
let $2 = $1[0];
|
|
617
|
+
if ($2) {
|
|
618
|
+
return new Error(new Eexist());
|
|
619
|
+
} else {
|
|
620
|
+
return write_bits(filepath, toBitArray([]));
|
|
621
|
+
}
|
|
622
|
+
} else {
|
|
623
|
+
return write_bits(filepath, toBitArray([]));
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Recursively creates necessary directories for a given directory
|
|
629
|
+
* path. Note that if you pass a path that "looks like" a file, i.e.
|
|
630
|
+
* `./a/b.txt`, a folder named `b.txt` will be created, so be sure
|
|
631
|
+
* to pass only the path to the required directory.
|
|
632
|
+
*/
|
|
633
|
+
export function create_directory_all(dirpath) {
|
|
634
|
+
return do_create_dir_all(dirpath + "/");
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Copy a file at a given path to another path.
|
|
639
|
+
* Note: destination should include the filename, not just the directory
|
|
640
|
+
*/
|
|
641
|
+
export function copy_file(src, dest) {
|
|
642
|
+
let _pipe = do_copy_file(src, dest);
|
|
643
|
+
return $result.replace(_pipe, undefined);
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function do_copy_directory(src, dest) {
|
|
647
|
+
return $result.try$(
|
|
648
|
+
read_directory(src),
|
|
649
|
+
(segments) => {
|
|
650
|
+
let _pipe = segments;
|
|
651
|
+
$list.each(
|
|
652
|
+
_pipe,
|
|
653
|
+
(segment) => {
|
|
654
|
+
let src_path = $filepath.join(src, segment);
|
|
655
|
+
let dest_path = $filepath.join(dest, segment);
|
|
656
|
+
return $result.try$(
|
|
657
|
+
file_info(src_path),
|
|
658
|
+
(src_info) => {
|
|
659
|
+
let $ = file_info_type(src_info);
|
|
660
|
+
if ($ instanceof File) {
|
|
661
|
+
return $result.try$(
|
|
662
|
+
read_bits(src_path),
|
|
663
|
+
(content) => {
|
|
664
|
+
let _pipe$1 = content;
|
|
665
|
+
return write_bits(dest_path, _pipe$1);
|
|
666
|
+
},
|
|
667
|
+
);
|
|
668
|
+
} else if ($ instanceof Directory) {
|
|
669
|
+
return $result.try$(
|
|
670
|
+
create_directory(dest_path),
|
|
671
|
+
(_) => { return do_copy_directory(src_path, dest_path); },
|
|
672
|
+
);
|
|
673
|
+
} else if ($ instanceof Symlink) {
|
|
674
|
+
return new Error(
|
|
675
|
+
new Unknown(
|
|
676
|
+
"This is an internal bug where the `file_info` is somehow returning info about a simlink. Please file an issue on the simplifile repo.",
|
|
677
|
+
),
|
|
678
|
+
);
|
|
679
|
+
} else {
|
|
680
|
+
return new Error(
|
|
681
|
+
new Unknown(
|
|
682
|
+
"Unknown file type (not file, directory, or simlink)",
|
|
683
|
+
),
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
);
|
|
688
|
+
},
|
|
689
|
+
)
|
|
690
|
+
return new Ok(undefined);
|
|
691
|
+
},
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Copy a directory recursively
|
|
697
|
+
*/
|
|
698
|
+
export function copy_directory(src, dest) {
|
|
699
|
+
return $result.try$(
|
|
700
|
+
create_directory_all(dest),
|
|
701
|
+
(_) => { return do_copy_directory(src, dest); },
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Copy a file or a directory to a new path. Copies directories recursively.
|
|
707
|
+
*
|
|
708
|
+
* ### Performance Note
|
|
709
|
+
* This function does work to determine if the src path
|
|
710
|
+
* points to a file or a directory. Consider using one of the the dedicated
|
|
711
|
+
* functions `copy_file` or `copy_directory` if you already know which one you need.
|
|
712
|
+
*/
|
|
713
|
+
export function copy(src, dest) {
|
|
714
|
+
return $result.try$(
|
|
715
|
+
file_info(src),
|
|
716
|
+
(src_info) => {
|
|
717
|
+
let $ = file_info_type(src_info);
|
|
718
|
+
if ($ instanceof File) {
|
|
719
|
+
return copy_file(src, dest);
|
|
720
|
+
} else if ($ instanceof Directory) {
|
|
721
|
+
return copy_directory(src, dest);
|
|
722
|
+
} else if ($ instanceof Symlink) {
|
|
723
|
+
return new Error(
|
|
724
|
+
new Unknown(
|
|
725
|
+
"This is an internal bug where the `file_info` is somehow returning info about a simlink. Please file an issue on the simplifile repo.",
|
|
726
|
+
),
|
|
727
|
+
);
|
|
728
|
+
} else {
|
|
729
|
+
return new Error(
|
|
730
|
+
new Unknown("Unknown file type (not file, directory, or simlink)"),
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Copy a directory recursively and then delete the old one.
|
|
739
|
+
*/
|
|
740
|
+
export function rename_directory(src, dest) {
|
|
741
|
+
return $result.try$(
|
|
742
|
+
copy_directory(src, dest),
|
|
743
|
+
(_) => { return delete$(src); },
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Clear the contents of a directory, deleting all files and directories within
|
|
749
|
+
* but leaving the top level directory in place.
|
|
750
|
+
*/
|
|
751
|
+
export function clear_directory(path) {
|
|
752
|
+
return $result.try$(
|
|
753
|
+
read_directory(path),
|
|
754
|
+
(paths) => {
|
|
755
|
+
let _pipe = paths;
|
|
756
|
+
let _pipe$1 = $list.map(
|
|
757
|
+
_pipe,
|
|
758
|
+
(_capture) => { return $filepath.join(path, _capture); },
|
|
759
|
+
);
|
|
760
|
+
return delete_all(_pipe$1);
|
|
761
|
+
},
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Returns a list of filepaths for every file in the directory, including nested
|
|
767
|
+
* files.
|
|
768
|
+
*/
|
|
769
|
+
export function get_files(directory) {
|
|
770
|
+
return $result.try$(
|
|
771
|
+
read_directory(directory),
|
|
772
|
+
(contents) => {
|
|
773
|
+
return $list.try_fold(
|
|
774
|
+
contents,
|
|
775
|
+
toList([]),
|
|
776
|
+
(acc, content) => {
|
|
777
|
+
let path = $filepath.join(directory, content);
|
|
778
|
+
return $result.try$(
|
|
779
|
+
file_info(path),
|
|
780
|
+
(info) => {
|
|
781
|
+
let $ = file_info_type(info);
|
|
782
|
+
if ($ instanceof File) {
|
|
783
|
+
return new Ok(listPrepend(path, acc));
|
|
784
|
+
} else if ($ instanceof Directory) {
|
|
785
|
+
return $result.try$(
|
|
786
|
+
get_files(path),
|
|
787
|
+
(nested_files) => {
|
|
788
|
+
return new Ok($list.append(acc, nested_files));
|
|
789
|
+
},
|
|
790
|
+
);
|
|
791
|
+
} else {
|
|
792
|
+
return new Ok(acc);
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
);
|
|
796
|
+
},
|
|
797
|
+
);
|
|
798
|
+
},
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
function permission_to_integer(permission) {
|
|
803
|
+
if (permission instanceof Read) {
|
|
804
|
+
return 0o4;
|
|
805
|
+
} else if (permission instanceof Write) {
|
|
806
|
+
return 0o2;
|
|
807
|
+
} else {
|
|
808
|
+
return 0o1;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function integer_to_permissions(integer) {
|
|
813
|
+
let $ = $int.bitwise_and(integer, 7);
|
|
814
|
+
if ($ === 7) {
|
|
815
|
+
return $set.from_list(toList([new Read(), new Write(), new Execute()]));
|
|
816
|
+
} else if ($ === 6) {
|
|
817
|
+
return $set.from_list(toList([new Read(), new Write()]));
|
|
818
|
+
} else if ($ === 5) {
|
|
819
|
+
return $set.from_list(toList([new Read(), new Execute()]));
|
|
820
|
+
} else if ($ === 3) {
|
|
821
|
+
return $set.from_list(toList([new Write(), new Execute()]));
|
|
822
|
+
} else if ($ === 4) {
|
|
823
|
+
return $set.from_list(toList([new Read()]));
|
|
824
|
+
} else if ($ === 2) {
|
|
825
|
+
return $set.from_list(toList([new Write()]));
|
|
826
|
+
} else if ($ === 1) {
|
|
827
|
+
return $set.from_list(toList([new Execute()]));
|
|
828
|
+
} else if ($ === 0) {
|
|
829
|
+
return $set.new$();
|
|
830
|
+
} else {
|
|
831
|
+
throw makeError(
|
|
832
|
+
"panic",
|
|
833
|
+
FILEPATH,
|
|
834
|
+
"simplifile",
|
|
835
|
+
667,
|
|
836
|
+
"integer_to_permissions",
|
|
837
|
+
"`panic` expression evaluated.",
|
|
838
|
+
{}
|
|
839
|
+
)
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
export function file_permissions_to_octal(permissions) {
|
|
844
|
+
let make_permission_digit = (permissions) => {
|
|
845
|
+
let _pipe = permissions;
|
|
846
|
+
let _pipe$1 = $set.to_list(_pipe);
|
|
847
|
+
let _pipe$2 = $list.map(_pipe$1, permission_to_integer);
|
|
848
|
+
return $int.sum(_pipe$2);
|
|
849
|
+
};
|
|
850
|
+
return (make_permission_digit(permissions.user) * 64 + make_permission_digit(
|
|
851
|
+
permissions.group,
|
|
852
|
+
) * 8) + make_permission_digit(permissions.other);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function octal_to_file_permissions(octal) {
|
|
856
|
+
return new FilePermissions(
|
|
857
|
+
(() => {
|
|
858
|
+
let _pipe = octal;
|
|
859
|
+
let _pipe$1 = $int.bitwise_shift_right(_pipe, 6);
|
|
860
|
+
return integer_to_permissions(_pipe$1);
|
|
861
|
+
})(),
|
|
862
|
+
(() => {
|
|
863
|
+
let _pipe = octal;
|
|
864
|
+
let _pipe$1 = $int.bitwise_shift_right(_pipe, 3);
|
|
865
|
+
return integer_to_permissions(_pipe$1);
|
|
866
|
+
})(),
|
|
867
|
+
(() => {
|
|
868
|
+
let _pipe = octal;
|
|
869
|
+
return integer_to_permissions(_pipe);
|
|
870
|
+
})(),
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Extract the `FilePermissions` from a given FileInfo value.
|
|
876
|
+
*/
|
|
877
|
+
export function file_info_permissions(file_info) {
|
|
878
|
+
return octal_to_file_permissions(file_info_permissions_octal(file_info));
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Sets the permissions for a given file
|
|
883
|
+
*
|
|
884
|
+
* # Example
|
|
885
|
+
* ```gleam
|
|
886
|
+
* let all = set.from_list([Read, Write, Execute])
|
|
887
|
+
* let all = FilePermissions(user: all, group: all, other: all)
|
|
888
|
+
* let assert Ok(Nil) = set_permissions("./script.sh", all)
|
|
889
|
+
* ```
|
|
890
|
+
*/
|
|
891
|
+
export function set_permissions(filepath, permissions) {
|
|
892
|
+
return set_permissions_octal(filepath, file_permissions_to_octal(permissions));
|
|
893
|
+
}
|