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,244 @@
|
|
|
1
|
+
%%% --------------------------------------------------
|
|
2
|
+
%%% @author Benjamin Peinhardt <benjaminpeinhardt@gmail.com>
|
|
3
|
+
%%% @doc Erlang ffi glue code for the simplifile Gleam package.
|
|
4
|
+
%%% @end
|
|
5
|
+
%%% --------------------------------------------------
|
|
6
|
+
|
|
7
|
+
-module(simplifile_erl).
|
|
8
|
+
|
|
9
|
+
-compile({no_auto_import,[link/2]}).
|
|
10
|
+
|
|
11
|
+
%% API
|
|
12
|
+
-export([
|
|
13
|
+
append_bits/2,
|
|
14
|
+
create_directory/1,
|
|
15
|
+
create_dir_all/1,
|
|
16
|
+
delete_file/1,
|
|
17
|
+
create_link/2,
|
|
18
|
+
create_symlink/2,
|
|
19
|
+
delete/1,
|
|
20
|
+
delete_directory/1,
|
|
21
|
+
file_info/1,
|
|
22
|
+
link_info/1,
|
|
23
|
+
is_directory/1,
|
|
24
|
+
is_file/1,
|
|
25
|
+
is_symlink/1,
|
|
26
|
+
read_bits/1,
|
|
27
|
+
read_directory/1,
|
|
28
|
+
rename_file/2,
|
|
29
|
+
set_permissions_octal/2,
|
|
30
|
+
write_bits/2
|
|
31
|
+
]).
|
|
32
|
+
|
|
33
|
+
-include_lib("kernel/include/file.hrl").
|
|
34
|
+
|
|
35
|
+
%% A macro for checking whether the error returned is one of the atoms for a posixe error.
|
|
36
|
+
-define(is_posix_error(Error),
|
|
37
|
+
Error =:= eacces
|
|
38
|
+
orelse Error =:= eagain
|
|
39
|
+
orelse Error =:= ebadf
|
|
40
|
+
orelse Error =:= ebadmsg
|
|
41
|
+
orelse Error =:= ebusy
|
|
42
|
+
orelse Error =:= edeadlk
|
|
43
|
+
orelse Error =:= edeadlock
|
|
44
|
+
orelse Error =:= edquot
|
|
45
|
+
orelse Error =:= eexist
|
|
46
|
+
orelse Error =:= efault
|
|
47
|
+
orelse Error =:= efbig
|
|
48
|
+
orelse Error =:= eftype
|
|
49
|
+
orelse Error =:= eintr
|
|
50
|
+
orelse Error =:= einval
|
|
51
|
+
orelse Error =:= eio
|
|
52
|
+
orelse Error =:= eisdir
|
|
53
|
+
orelse Error =:= eloop
|
|
54
|
+
orelse Error =:= emfile
|
|
55
|
+
orelse Error =:= emlink
|
|
56
|
+
orelse Error =:= emultihop
|
|
57
|
+
orelse Error =:= enametoolong
|
|
58
|
+
orelse Error =:= enfile
|
|
59
|
+
orelse Error =:= enobufs
|
|
60
|
+
orelse Error =:= enodev
|
|
61
|
+
orelse Error =:= enolck
|
|
62
|
+
orelse Error =:= enolink
|
|
63
|
+
orelse Error =:= enoent
|
|
64
|
+
orelse Error =:= enomem
|
|
65
|
+
orelse Error =:= enospc
|
|
66
|
+
orelse Error =:= enosr
|
|
67
|
+
orelse Error =:= enostr
|
|
68
|
+
orelse Error =:= enosys
|
|
69
|
+
orelse Error =:= enotblk
|
|
70
|
+
orelse Error =:= enotdir
|
|
71
|
+
orelse Error =:= enotsup
|
|
72
|
+
orelse Error =:= enxio
|
|
73
|
+
orelse Error =:= eopnotsupp
|
|
74
|
+
orelse Error =:= eoverflow
|
|
75
|
+
orelse Error =:= eperm
|
|
76
|
+
orelse Error =:= epipe
|
|
77
|
+
orelse Error =:= erange
|
|
78
|
+
orelse Error =:= erofs
|
|
79
|
+
orelse Error =:= espipe
|
|
80
|
+
orelse Error =:= esrch
|
|
81
|
+
orelse Error =:= estale
|
|
82
|
+
orelse Error =:= etxtbsy
|
|
83
|
+
orelse Error =:= exdev).
|
|
84
|
+
|
|
85
|
+
%% Only return the error if it's a posix error. Also converts ok to {ok, nil},
|
|
86
|
+
%% as gleam doesn't have atoms.
|
|
87
|
+
posix_result(Result) ->
|
|
88
|
+
case Result of
|
|
89
|
+
ok ->
|
|
90
|
+
{ok, nil};
|
|
91
|
+
{ok, Value} ->
|
|
92
|
+
{ok, Value};
|
|
93
|
+
{error, Reason} when ?is_posix_error(Reason) ->
|
|
94
|
+
{error, Reason};
|
|
95
|
+
{error, Reason} ->
|
|
96
|
+
{error, {unknown, string:uppercase(atom_to_binary(Reason))}}
|
|
97
|
+
end.
|
|
98
|
+
|
|
99
|
+
%% Read the binary contents of a file
|
|
100
|
+
read_bits(Filename) ->
|
|
101
|
+
posix_result(file:read_file(Filename)).
|
|
102
|
+
|
|
103
|
+
%% Write bytes to a file
|
|
104
|
+
write_bits(Filename, Contents) ->
|
|
105
|
+
case bit_size(Contents) rem 8 of
|
|
106
|
+
0 -> posix_result(file:write_file(Filename, Contents));
|
|
107
|
+
_ -> {error, einval}
|
|
108
|
+
end.
|
|
109
|
+
|
|
110
|
+
%% Append bytes to a file
|
|
111
|
+
append_bits(Filename, Contents) ->
|
|
112
|
+
case bit_size(Contents) rem 8 of
|
|
113
|
+
0 -> posix_result(file:write_file(Filename, Contents, [append]));
|
|
114
|
+
_ -> {error, einval}
|
|
115
|
+
end.
|
|
116
|
+
|
|
117
|
+
%% Delete the file at the given path
|
|
118
|
+
delete_file(Filename) ->
|
|
119
|
+
posix_result(file:delete(Filename)).
|
|
120
|
+
|
|
121
|
+
%% Create a directory at the given path. Missing parent directories are not created.
|
|
122
|
+
create_directory(Dir) ->
|
|
123
|
+
posix_result(file:make_dir(Dir)).
|
|
124
|
+
|
|
125
|
+
%% Create a symbolic link New to the file or directory Existing (does not need to exist).
|
|
126
|
+
create_symlink(Existing, New) ->
|
|
127
|
+
posix_result(file:make_symlink(Existing, New)).
|
|
128
|
+
|
|
129
|
+
%% Create a "hard link" New to the file or directory Existing.
|
|
130
|
+
create_link(Existing, New) ->
|
|
131
|
+
posix_result(file:make_link(Existing, New)).
|
|
132
|
+
|
|
133
|
+
%% List the contents of a directory
|
|
134
|
+
read_directory(Dir) ->
|
|
135
|
+
case file:list_dir(Dir) of
|
|
136
|
+
{ok, Filenames} ->
|
|
137
|
+
{ok, [unicode:characters_to_binary(Filename) || Filename <- Filenames]};
|
|
138
|
+
{error, Reason} when ?is_posix_error(Reason) ->
|
|
139
|
+
{error, Reason}
|
|
140
|
+
end.
|
|
141
|
+
|
|
142
|
+
%% Delete a directory at the given path. Directory must be empty.
|
|
143
|
+
delete_directory(Dir) ->
|
|
144
|
+
posix_result(file:del_dir(Dir)).
|
|
145
|
+
|
|
146
|
+
%% Deletes a file/directory and everything in it.
|
|
147
|
+
delete(Dir) ->
|
|
148
|
+
posix_result(file:del_dir_r(Dir)).
|
|
149
|
+
|
|
150
|
+
%% Creates the entire path for a given directory to exist
|
|
151
|
+
create_dir_all(Filename) ->
|
|
152
|
+
posix_result(filelib:ensure_path(Filename)).
|
|
153
|
+
|
|
154
|
+
%% Move file from one path to another
|
|
155
|
+
rename_file(Source, Destination) ->
|
|
156
|
+
posix_result(file:rename(Source, Destination)).
|
|
157
|
+
|
|
158
|
+
%% Set the permissions for the given file.
|
|
159
|
+
set_permissions_octal(Filename, Permissions) ->
|
|
160
|
+
posix_result(file:change_mode(Filename, Permissions)).
|
|
161
|
+
|
|
162
|
+
is_directory(Path) ->
|
|
163
|
+
case file:read_file_info(Path) of
|
|
164
|
+
{ok, FileInfo} ->
|
|
165
|
+
case FileInfo#file_info.type of
|
|
166
|
+
directory ->
|
|
167
|
+
{ok, true};
|
|
168
|
+
_ ->
|
|
169
|
+
{ok, false}
|
|
170
|
+
end;
|
|
171
|
+
{error, enoent} ->
|
|
172
|
+
{ok, false};
|
|
173
|
+
{error, Reason} ->
|
|
174
|
+
posix_result({error, Reason})
|
|
175
|
+
end.
|
|
176
|
+
|
|
177
|
+
is_file(Path) ->
|
|
178
|
+
case file:read_file_info(Path) of
|
|
179
|
+
{ok, FileInfo} ->
|
|
180
|
+
case FileInfo#file_info.type of
|
|
181
|
+
regular ->
|
|
182
|
+
{ok, true};
|
|
183
|
+
_ ->
|
|
184
|
+
{ok, false}
|
|
185
|
+
end;
|
|
186
|
+
{error, enoent} ->
|
|
187
|
+
{ok, false};
|
|
188
|
+
{error, Reason} ->
|
|
189
|
+
posix_result({error, Reason})
|
|
190
|
+
end.
|
|
191
|
+
|
|
192
|
+
is_symlink(Path) ->
|
|
193
|
+
case file:read_link_info(Path) of
|
|
194
|
+
{ok, FileInfo} ->
|
|
195
|
+
case FileInfo#file_info.type of
|
|
196
|
+
symlink ->
|
|
197
|
+
{ok, true};
|
|
198
|
+
_ ->
|
|
199
|
+
{ok, false}
|
|
200
|
+
end;
|
|
201
|
+
{error, enoent} ->
|
|
202
|
+
{ok, false};
|
|
203
|
+
{error, Reason} ->
|
|
204
|
+
posix_result({error, Reason})
|
|
205
|
+
end.
|
|
206
|
+
|
|
207
|
+
file_info_result(Result) ->
|
|
208
|
+
case Result of
|
|
209
|
+
{ok,
|
|
210
|
+
{file_info,
|
|
211
|
+
Size,
|
|
212
|
+
_Type,
|
|
213
|
+
_Access,
|
|
214
|
+
Atime,
|
|
215
|
+
Mtime,
|
|
216
|
+
Ctime,
|
|
217
|
+
Mode,
|
|
218
|
+
Links,
|
|
219
|
+
MajorDevice,
|
|
220
|
+
_MinorDevice,
|
|
221
|
+
Inode,
|
|
222
|
+
Uid,
|
|
223
|
+
Gid}} ->
|
|
224
|
+
{ok,
|
|
225
|
+
{file_info,
|
|
226
|
+
Size,
|
|
227
|
+
Mode,
|
|
228
|
+
Links,
|
|
229
|
+
Inode,
|
|
230
|
+
Uid,
|
|
231
|
+
Gid,
|
|
232
|
+
MajorDevice,
|
|
233
|
+
Atime,
|
|
234
|
+
Mtime,
|
|
235
|
+
Ctime}};
|
|
236
|
+
{error, Reason} when ?is_posix_error(Reason) ->
|
|
237
|
+
Result
|
|
238
|
+
end.
|
|
239
|
+
|
|
240
|
+
file_info(Filename) ->
|
|
241
|
+
file_info_result(file:read_file_info(Filename, [{time, posix}])).
|
|
242
|
+
|
|
243
|
+
link_info(Filename) ->
|
|
244
|
+
file_info_result(file:read_link_info(Filename, [{time, posix}])).
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import { BitArray, Ok, Error as GError, toList } from "./gleam.mjs";
|
|
7
|
+
import * as $simplifile from "./simplifile.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Read the contents of a file as a BitArray
|
|
11
|
+
*
|
|
12
|
+
* @param {string} filepath
|
|
13
|
+
* @returns {Ok | GError} A Result with the BitArray of the file contents
|
|
14
|
+
*/
|
|
15
|
+
export function readBits(filepath) {
|
|
16
|
+
return gleamResult(() => {
|
|
17
|
+
const contents = fs.readFileSync(path.normalize(filepath));
|
|
18
|
+
return new BitArray(new Uint8Array(contents));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Write the given BitArray to a file
|
|
24
|
+
*
|
|
25
|
+
* @param {string} filepath
|
|
26
|
+
* @param {BitArray} contents
|
|
27
|
+
* @returns {Ok | GError}
|
|
28
|
+
*/
|
|
29
|
+
export function writeBits(filepath, contents) {
|
|
30
|
+
return gleamResult(() =>
|
|
31
|
+
fs.writeFileSync(path.normalize(filepath), toUint8Array(contents))
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Append the given BitArray to a file
|
|
37
|
+
*
|
|
38
|
+
* @param {string} filepath
|
|
39
|
+
* @param {BitArray} contents
|
|
40
|
+
* @returns {Ok | GError}
|
|
41
|
+
*/
|
|
42
|
+
export function appendBits(filepath, contents) {
|
|
43
|
+
return gleamResult(() =>
|
|
44
|
+
fs.appendFileSync(path.normalize(filepath), toUint8Array(contents))
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns a BitArray as an aligned Uint8Array. Avoids a copy when possible.
|
|
50
|
+
*
|
|
51
|
+
* @param {BitArray} contents
|
|
52
|
+
* @returns Uint8Array
|
|
53
|
+
*/
|
|
54
|
+
function toUint8Array(contents) {
|
|
55
|
+
if (contents.bitSize % 8 !== 0) {
|
|
56
|
+
throw new GError(new $simplifile.Einval());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let buffer = contents.rawBuffer;
|
|
60
|
+
if (contents.bitOffset !== 0) {
|
|
61
|
+
buffer = new Uint8Array(contents.byteSize);
|
|
62
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
63
|
+
buffer[i] = contents.byteAt(i);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return buffer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Check whether a file exists at the given path
|
|
72
|
+
*
|
|
73
|
+
* @param {string} filepath
|
|
74
|
+
* @returns {Ok | GError}
|
|
75
|
+
*/
|
|
76
|
+
export function isFile(filepath) {
|
|
77
|
+
try {
|
|
78
|
+
return new Ok(fs.statSync(path.normalize(filepath)).isFile());
|
|
79
|
+
} catch (e) {
|
|
80
|
+
if (e.code === "ENOENT") {
|
|
81
|
+
return new Ok(false);
|
|
82
|
+
} else {
|
|
83
|
+
return new GError(cast_error(e.code));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Check whether a symbolic link exists at the given path
|
|
90
|
+
*
|
|
91
|
+
* @param {string} filepath
|
|
92
|
+
* @returns {Ok | GError}
|
|
93
|
+
*/
|
|
94
|
+
export function isSymlink(filepath) {
|
|
95
|
+
try {
|
|
96
|
+
return new Ok(fs.lstatSync(path.normalize(filepath)).isSymbolicLink());
|
|
97
|
+
} catch (e) {
|
|
98
|
+
if (e.code === "ENOENT") {
|
|
99
|
+
return new Ok(false);
|
|
100
|
+
} else {
|
|
101
|
+
return new GError(cast_error(e.code));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Check whether a directory exists at the given path
|
|
108
|
+
*
|
|
109
|
+
* @param {string} filepath
|
|
110
|
+
* @returns {Ok | GError}
|
|
111
|
+
*/
|
|
112
|
+
export function isDirectory(filepath) {
|
|
113
|
+
try {
|
|
114
|
+
return new Ok(fs.statSync(path.normalize(filepath)).isDirectory());
|
|
115
|
+
} catch (e) {
|
|
116
|
+
if (e.code === "ENOENT") {
|
|
117
|
+
return new Ok(false);
|
|
118
|
+
} else {
|
|
119
|
+
return new GError(cast_error(e.code));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Create the symbolic link called path pointing to target
|
|
126
|
+
*
|
|
127
|
+
* @param {string} target
|
|
128
|
+
* @param {string} path
|
|
129
|
+
* @returns {Ok | GError}
|
|
130
|
+
*/
|
|
131
|
+
export function createSymlink(target, path) {
|
|
132
|
+
return gleamResult(() => fs.symlinkSync(target, path));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Create the "hard link" called path pointing to the target
|
|
137
|
+
*
|
|
138
|
+
* @param {string} target
|
|
139
|
+
* @param {string} path
|
|
140
|
+
* returns {ok | GError}
|
|
141
|
+
*/
|
|
142
|
+
export function createLink(target, path) {
|
|
143
|
+
return gleamResult(() => fs.linkSync(target, path));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Create a directory at the given filepath
|
|
148
|
+
*
|
|
149
|
+
* @param {string} filepath
|
|
150
|
+
* @returns {Ok | GError}
|
|
151
|
+
*/
|
|
152
|
+
export function createDirectory(filepath) {
|
|
153
|
+
return gleamResult(() => fs.mkdirSync(path.normalize(filepath)));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Recursively create a directory structure from the given path.
|
|
158
|
+
*
|
|
159
|
+
* @param {string} filepath
|
|
160
|
+
* @returns {Ok | GError}
|
|
161
|
+
*/
|
|
162
|
+
export function createDirAll(filepath) {
|
|
163
|
+
return gleamResult(() => {
|
|
164
|
+
fs.mkdirSync(path.normalize(filepath), { recursive: true });
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Recursively delete a directory or delete a file at the given path.
|
|
170
|
+
*
|
|
171
|
+
* @param {string} fileOrDirPath
|
|
172
|
+
* @returns {Ok | GError}
|
|
173
|
+
*/
|
|
174
|
+
export function delete_(fileOrDirPath) {
|
|
175
|
+
return gleamResult(() => {
|
|
176
|
+
const isDir = isDirectory(fileOrDirPath);
|
|
177
|
+
if (isDir instanceof Ok && isDir[0] === true) {
|
|
178
|
+
fs.rmSync(path.normalize(fileOrDirPath), { recursive: true });
|
|
179
|
+
} else {
|
|
180
|
+
fs.unlinkSync(path.normalize(fileOrDirPath));
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* List the contents of a directory.
|
|
187
|
+
*
|
|
188
|
+
* @param {string} filepath
|
|
189
|
+
* @returns {Ok | GError}
|
|
190
|
+
*/
|
|
191
|
+
export function readDirectory(filepath) {
|
|
192
|
+
return gleamResult(() => toList(fs.readdirSync(path.normalize(filepath))));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Copy a file to a new path.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} srcpath
|
|
199
|
+
* @param {string} destpath
|
|
200
|
+
* @returns {Ok | GError}
|
|
201
|
+
*/
|
|
202
|
+
export function copyFile(srcpath, destpath) {
|
|
203
|
+
return gleamResult(() =>
|
|
204
|
+
fs.copyFileSync(path.normalize(srcpath), path.normalize(destpath)),
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Move a file to the new path.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} srcpath
|
|
212
|
+
* @param {string} destpath
|
|
213
|
+
* @returns {Ok | GError}
|
|
214
|
+
*/
|
|
215
|
+
export function renameFile(srcpath, destpath) {
|
|
216
|
+
return gleamResult(() =>
|
|
217
|
+
fs.renameSync(path.normalize(srcpath), path.normalize(destpath)),
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Set the file permissions. Octal number should be in base 8.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} filepath
|
|
225
|
+
* @param {number} octalNumber
|
|
226
|
+
* @returns {Ok | GError}
|
|
227
|
+
*/
|
|
228
|
+
export function setPermissionsOctal(filepath, octalNumber) {
|
|
229
|
+
return gleamResult(() => fs.chmodSync(path.normalize(filepath), octalNumber));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Return the current directory.
|
|
234
|
+
*
|
|
235
|
+
* @returns {Ok | GError} The current directory
|
|
236
|
+
*/
|
|
237
|
+
export function currentDirectory() {
|
|
238
|
+
return gleamResult(() => process.cwd());
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
*
|
|
243
|
+
* @param {string} filepath
|
|
244
|
+
* @returns {Ok | GError}
|
|
245
|
+
*/
|
|
246
|
+
export function fileInfo(filepath) {
|
|
247
|
+
return gleamResult(() => {
|
|
248
|
+
const stat = fs.statSync(path.normalize(filepath));
|
|
249
|
+
return new FileInfo(stat);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @param {string} filepath
|
|
255
|
+
* @returns {Ok | GError}
|
|
256
|
+
*/
|
|
257
|
+
export function linkInfo(filepath) {
|
|
258
|
+
return gleamResult(() => {
|
|
259
|
+
const stat = fs.lstatSync(path.normalize(filepath));
|
|
260
|
+
return new FileInfo(stat);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
class FileInfo {
|
|
265
|
+
/**
|
|
266
|
+
* @param {fs.Stats} stat
|
|
267
|
+
*/
|
|
268
|
+
constructor(stat) {
|
|
269
|
+
this.size = stat.size;
|
|
270
|
+
this.mode = stat.mode;
|
|
271
|
+
this.nlinks = stat.nlink;
|
|
272
|
+
this.inode = stat.ino;
|
|
273
|
+
this.user_id = stat.uid;
|
|
274
|
+
this.group_id = stat.gid;
|
|
275
|
+
this.dev = stat.dev;
|
|
276
|
+
this.atime_seconds = Math.floor(stat.atimeMs / 1000);
|
|
277
|
+
this.mtime_seconds = Math.floor(stat.mtimeMs / 1000);
|
|
278
|
+
this.ctime_seconds = Math.floor(stat.ctimeMs / 1000);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Perform some operation and return a Gleam `Result(a, String)`
|
|
284
|
+
* where `a` is the type returned by the operation and the `String`
|
|
285
|
+
* is the error code.
|
|
286
|
+
*
|
|
287
|
+
* @param {function():any} op
|
|
288
|
+
* @returns {Ok | GError}
|
|
289
|
+
*/
|
|
290
|
+
function gleamResult(op) {
|
|
291
|
+
try {
|
|
292
|
+
const val = op();
|
|
293
|
+
return new Ok(val);
|
|
294
|
+
} catch (e) {
|
|
295
|
+
return new GError(cast_error(e.code));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function cast_error(error_code) {
|
|
300
|
+
switch (error_code) {
|
|
301
|
+
case "EACCES":
|
|
302
|
+
return new $simplifile.Eacces();
|
|
303
|
+
case "EAGAIN":
|
|
304
|
+
return new $simplifile.Eagain();
|
|
305
|
+
case "EBADF":
|
|
306
|
+
return new $simplifile.Ebadf();
|
|
307
|
+
case "EBADMSG":
|
|
308
|
+
return new $simplifile.Ebadmsg();
|
|
309
|
+
case "EBUSY":
|
|
310
|
+
return new $simplifile.Ebusy();
|
|
311
|
+
case "EDEADLK":
|
|
312
|
+
return new $simplifile.Edeadlk();
|
|
313
|
+
case "EDEADLOCK":
|
|
314
|
+
return new $simplifile.Edeadlock();
|
|
315
|
+
case "EDQUOT":
|
|
316
|
+
return new $simplifile.Edquot();
|
|
317
|
+
case "EEXIST":
|
|
318
|
+
return new $simplifile.Eexist();
|
|
319
|
+
case "EFAULT":
|
|
320
|
+
return new $simplifile.Efault();
|
|
321
|
+
case "EFBIG":
|
|
322
|
+
return new $simplifile.Efbig();
|
|
323
|
+
case "EFTYPE":
|
|
324
|
+
return new $simplifile.Eftype();
|
|
325
|
+
case "EINTR":
|
|
326
|
+
return new $simplifile.Eintr();
|
|
327
|
+
case "EINVAL":
|
|
328
|
+
return new $simplifile.Einval();
|
|
329
|
+
case "EIO":
|
|
330
|
+
return new $simplifile.Eio();
|
|
331
|
+
case "EISDIR":
|
|
332
|
+
return new $simplifile.Eisdir();
|
|
333
|
+
case "ELOOP":
|
|
334
|
+
return new $simplifile.Eloop();
|
|
335
|
+
case "EMFILE":
|
|
336
|
+
return new $simplifile.Emfile();
|
|
337
|
+
case "EMLINK":
|
|
338
|
+
return new $simplifile.Emlink();
|
|
339
|
+
case "EMULTIHOP":
|
|
340
|
+
return new $simplifile.Emultihop();
|
|
341
|
+
case "ENAMETOOLONG":
|
|
342
|
+
return new $simplifile.Enametoolong();
|
|
343
|
+
case "ENFILE":
|
|
344
|
+
return new $simplifile.Enfile();
|
|
345
|
+
case "ENOBUFS":
|
|
346
|
+
return new $simplifile.Enobufs();
|
|
347
|
+
case "ENODEV":
|
|
348
|
+
return new $simplifile.Enodev();
|
|
349
|
+
case "ENOLCK":
|
|
350
|
+
return new $simplifile.Enolck();
|
|
351
|
+
case "ENOLINK":
|
|
352
|
+
return new $simplifile.Enolink();
|
|
353
|
+
case "ENOENT":
|
|
354
|
+
return new $simplifile.Enoent();
|
|
355
|
+
case "ENOMEM":
|
|
356
|
+
return new $simplifile.Enomem();
|
|
357
|
+
case "ENOSPC":
|
|
358
|
+
return new $simplifile.Enospc();
|
|
359
|
+
case "ENOSR":
|
|
360
|
+
return new $simplifile.Enosr();
|
|
361
|
+
case "ENOSTR":
|
|
362
|
+
return new $simplifile.Enostr();
|
|
363
|
+
case "ENOSYS":
|
|
364
|
+
return new $simplifile.Enosys();
|
|
365
|
+
case "ENOBLK":
|
|
366
|
+
return new $simplifile.Enotblk();
|
|
367
|
+
case "ENOTDIR":
|
|
368
|
+
return new $simplifile.Enotdir();
|
|
369
|
+
case "ENOTSUP":
|
|
370
|
+
return new $simplifile.Enotsup();
|
|
371
|
+
case "ENXIO":
|
|
372
|
+
return new $simplifile.Enxio();
|
|
373
|
+
case "EOPNOTSUPP":
|
|
374
|
+
return new $simplifile.Eopnotsupp();
|
|
375
|
+
case "EOVERFLOW":
|
|
376
|
+
return new $simplifile.Eoverflow();
|
|
377
|
+
case "EPERM":
|
|
378
|
+
return new $simplifile.Eperm();
|
|
379
|
+
case "EPIPE":
|
|
380
|
+
return new $simplifile.Epipe();
|
|
381
|
+
case "ERANGE":
|
|
382
|
+
return new $simplifile.Erange();
|
|
383
|
+
case "EROFS":
|
|
384
|
+
return new $simplifile.Erofs();
|
|
385
|
+
case "ESPIPE":
|
|
386
|
+
return new $simplifile.Espipe();
|
|
387
|
+
case "ESRCH":
|
|
388
|
+
return new $simplifile.Esrch();
|
|
389
|
+
case "ESTALE":
|
|
390
|
+
return new $simplifile.Estale();
|
|
391
|
+
case "ETXTBSY":
|
|
392
|
+
return new $simplifile.Etxtbsy();
|
|
393
|
+
case "EXDEV":
|
|
394
|
+
return new $simplifile.Exdev();
|
|
395
|
+
case "NOTUTF8":
|
|
396
|
+
return new $simplifile.NotUtf8();
|
|
397
|
+
default:
|
|
398
|
+
return new $simplifile.Unknown(error_code);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|