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
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# skillc
|
|
2
|
+
|
|
3
|
+
[](https://hex.pm/packages/skillc)
|
|
4
|
+
[](https://hexdocs.pm/skillc/)
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
gleam add skillc@1
|
|
8
|
+
```
|
|
9
|
+
```gleam
|
|
10
|
+
import skillc
|
|
11
|
+
|
|
12
|
+
pub fn main() -> Nil {
|
|
13
|
+
// TODO: An example of the project in use
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Further documentation can be found at <https://hexdocs.pm/skillc>.
|
|
18
|
+
|
|
19
|
+
## Development
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
gleam run # Run the project
|
|
23
|
+
gleam test # Run the tests
|
|
24
|
+
```
|
package/bin/skillc.mjs
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-module(argv).
|
|
2
|
+
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
|
|
3
|
+
|
|
4
|
+
-export([load/0]).
|
|
5
|
+
-export_type([argv/0]).
|
|
6
|
+
|
|
7
|
+
-type argv() :: {argv, binary(), binary(), list(binary())}.
|
|
8
|
+
|
|
9
|
+
-spec load() -> argv().
|
|
10
|
+
load() ->
|
|
11
|
+
{Runtime, Program, Arguments} = argv_ffi:load(),
|
|
12
|
+
{argv, Runtime, Program, Arguments}.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { load as do$ } from "./argv_ffi.mjs";
|
|
2
|
+
import { CustomType as $CustomType } from "./gleam.mjs";
|
|
3
|
+
|
|
4
|
+
export class Argv extends $CustomType {
|
|
5
|
+
constructor(runtime, program, arguments$) {
|
|
6
|
+
super();
|
|
7
|
+
this.runtime = runtime;
|
|
8
|
+
this.program = program;
|
|
9
|
+
this.arguments = arguments$;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export const Argv$Argv = (runtime, program, arguments$) =>
|
|
13
|
+
new Argv(runtime, program, arguments$);
|
|
14
|
+
export const Argv$isArgv = (value) => value instanceof Argv;
|
|
15
|
+
export const Argv$Argv$runtime = (value) => value.runtime;
|
|
16
|
+
export const Argv$Argv$0 = (value) => value.runtime;
|
|
17
|
+
export const Argv$Argv$program = (value) => value.program;
|
|
18
|
+
export const Argv$Argv$1 = (value) => value.program;
|
|
19
|
+
export const Argv$Argv$arguments = (value) => value.arguments;
|
|
20
|
+
export const Argv$Argv$2 = (value) => value.arguments;
|
|
21
|
+
|
|
22
|
+
export function load() {
|
|
23
|
+
let $ = do$();
|
|
24
|
+
let runtime;
|
|
25
|
+
let program;
|
|
26
|
+
let arguments$;
|
|
27
|
+
runtime = $[0];
|
|
28
|
+
program = $[1];
|
|
29
|
+
arguments$ = $[2];
|
|
30
|
+
return new Argv(runtime, program, arguments$);
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-module(argv_ffi).
|
|
2
|
+
|
|
3
|
+
-export([load/0]).
|
|
4
|
+
|
|
5
|
+
load() ->
|
|
6
|
+
Runtime = <<(stringarg(bindir))/binary, "/", (stringarg(progname))/binary>>,
|
|
7
|
+
PlainArguments = lists:map(
|
|
8
|
+
fun(Arg) -> unicode:characters_to_binary(Arg, utf8) end, init:get_plain_arguments()
|
|
9
|
+
),
|
|
10
|
+
{Program, Arguments} = case init:get_argument(escript) of
|
|
11
|
+
% We're in an escript, so the first argument is the executable name
|
|
12
|
+
{ok, _} ->
|
|
13
|
+
[P | Rest] = PlainArguments,
|
|
14
|
+
{P, Rest};
|
|
15
|
+
|
|
16
|
+
% We're not in a escript. Assume the cwd is the project root.
|
|
17
|
+
_ ->
|
|
18
|
+
{ok, Cwd} = file:get_cwd(),
|
|
19
|
+
{unicode:characters_to_binary(Cwd, utf8), PlainArguments}
|
|
20
|
+
end,
|
|
21
|
+
{Runtime, Program, Arguments}.
|
|
22
|
+
|
|
23
|
+
stringarg(Name) ->
|
|
24
|
+
case init:get_argument(Name) of
|
|
25
|
+
{ok, [[Value]]} -> list_to_binary(Value);
|
|
26
|
+
_ -> <<>>
|
|
27
|
+
end.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { List } from "./gleam.mjs";
|
|
2
|
+
|
|
3
|
+
export function load() {
|
|
4
|
+
if (globalThis.process) {
|
|
5
|
+
const [runtime, program, ...args] = process.argv;
|
|
6
|
+
return [runtime, program, List.fromArray(args)];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (globalThis.Deno) {
|
|
10
|
+
const runtime = Deno.execPath();
|
|
11
|
+
const program = new URL(Deno.mainModule).pathname;
|
|
12
|
+
const args = List.fromArray(Deno.args);
|
|
13
|
+
return [runtime, program, args];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const runtime = "browser";
|
|
17
|
+
const program = document.location.toString();
|
|
18
|
+
const args = List.fromArray([]);
|
|
19
|
+
return [runtime, program, args];
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../prelude.mjs";
|
|
Binary file
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
-module(filepath).
|
|
2
|
+
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
|
|
3
|
+
|
|
4
|
+
-export([join/2, split_unix/1, directory_name/1, is_absolute/1, split_windows/1, split/1, base_name/1, extension/1, strip_extension/1, expand/1]).
|
|
5
|
+
|
|
6
|
+
-if(?OTP_RELEASE >= 27).
|
|
7
|
+
-define(MODULEDOC(Str), -moduledoc(Str)).
|
|
8
|
+
-define(DOC(Str), -doc(Str)).
|
|
9
|
+
-else.
|
|
10
|
+
-define(MODULEDOC(Str), -compile([])).
|
|
11
|
+
-define(DOC(Str), -compile([])).
|
|
12
|
+
-endif.
|
|
13
|
+
|
|
14
|
+
?MODULEDOC(
|
|
15
|
+
" Work with file paths in Gleam!\n"
|
|
16
|
+
"\n"
|
|
17
|
+
" This library expects paths to be valid unicode. If you need to work with\n"
|
|
18
|
+
" non-unicode paths you will need to convert them to unicode before using\n"
|
|
19
|
+
" this library.\n"
|
|
20
|
+
).
|
|
21
|
+
|
|
22
|
+
-file("src/filepath.gleam", 49).
|
|
23
|
+
-spec relative(binary()) -> binary().
|
|
24
|
+
relative(Path) ->
|
|
25
|
+
case Path of
|
|
26
|
+
<<"/"/utf8, Path@1/binary>> ->
|
|
27
|
+
relative(Path@1);
|
|
28
|
+
|
|
29
|
+
_ ->
|
|
30
|
+
Path
|
|
31
|
+
end.
|
|
32
|
+
|
|
33
|
+
-file("src/filepath.gleam", 56).
|
|
34
|
+
-spec remove_trailing_slash(binary()) -> binary().
|
|
35
|
+
remove_trailing_slash(Path) ->
|
|
36
|
+
case gleam@string:ends_with(Path, <<"/"/utf8>>) of
|
|
37
|
+
true ->
|
|
38
|
+
gleam@string:drop_end(Path, 1);
|
|
39
|
+
|
|
40
|
+
false ->
|
|
41
|
+
Path
|
|
42
|
+
end.
|
|
43
|
+
|
|
44
|
+
-file("src/filepath.gleam", 35).
|
|
45
|
+
?DOC(
|
|
46
|
+
" Join two paths together.\n"
|
|
47
|
+
"\n"
|
|
48
|
+
" This function does not expand `..` or `.` segments, use the `expand`\n"
|
|
49
|
+
" function to do this.\n"
|
|
50
|
+
"\n"
|
|
51
|
+
" ## Examples\n"
|
|
52
|
+
"\n"
|
|
53
|
+
" ```gleam\n"
|
|
54
|
+
" join(\"/usr/local\", \"bin\")\n"
|
|
55
|
+
" // -> \"/usr/local/bin\"\n"
|
|
56
|
+
" ```\n"
|
|
57
|
+
).
|
|
58
|
+
-spec join(binary(), binary()) -> binary().
|
|
59
|
+
join(Left, Right) ->
|
|
60
|
+
_pipe@2 = case {Left, Right} of
|
|
61
|
+
{_, <<"/"/utf8>>} ->
|
|
62
|
+
Left;
|
|
63
|
+
|
|
64
|
+
{<<""/utf8>>, _} ->
|
|
65
|
+
relative(Right);
|
|
66
|
+
|
|
67
|
+
{<<"/"/utf8>>, <<"/"/utf8, _/binary>>} ->
|
|
68
|
+
Right;
|
|
69
|
+
|
|
70
|
+
{<<"/"/utf8>>, _} ->
|
|
71
|
+
<<Left/binary, Right/binary>>;
|
|
72
|
+
|
|
73
|
+
{_, _} ->
|
|
74
|
+
_pipe = remove_trailing_slash(Left),
|
|
75
|
+
_pipe@1 = gleam@string:append(_pipe, <<"/"/utf8>>),
|
|
76
|
+
gleam@string:append(_pipe@1, relative(Right))
|
|
77
|
+
end,
|
|
78
|
+
remove_trailing_slash(_pipe@2).
|
|
79
|
+
|
|
80
|
+
-file("src/filepath.gleam", 97).
|
|
81
|
+
?DOC(
|
|
82
|
+
" Split a path into its segments, using `/` as the path separator.\n"
|
|
83
|
+
"\n"
|
|
84
|
+
" Typically you would want to use `split` instead of this function, but if you\n"
|
|
85
|
+
" want non-Windows path behaviour on a Windows system then you can use this\n"
|
|
86
|
+
" function.\n"
|
|
87
|
+
"\n"
|
|
88
|
+
" ## Examples\n"
|
|
89
|
+
"\n"
|
|
90
|
+
" ```gleam\n"
|
|
91
|
+
" split(\"/usr/local/bin\", \"bin\")\n"
|
|
92
|
+
" // -> [\"/\", \"usr\", \"local\", \"bin\"]\n"
|
|
93
|
+
" ```\n"
|
|
94
|
+
).
|
|
95
|
+
-spec split_unix(binary()) -> list(binary()).
|
|
96
|
+
split_unix(Path) ->
|
|
97
|
+
_pipe = case gleam@string:split(Path, <<"/"/utf8>>) of
|
|
98
|
+
[<<""/utf8>>] ->
|
|
99
|
+
[];
|
|
100
|
+
|
|
101
|
+
[<<""/utf8>> | Rest] ->
|
|
102
|
+
[<<"/"/utf8>> | Rest];
|
|
103
|
+
|
|
104
|
+
Rest@1 ->
|
|
105
|
+
Rest@1
|
|
106
|
+
end,
|
|
107
|
+
gleam@list:filter(_pipe, fun(X) -> X /= <<""/utf8>> end).
|
|
108
|
+
|
|
109
|
+
-file("src/filepath.gleam", 267).
|
|
110
|
+
-spec get_directory_name(list(binary()), binary(), binary()) -> binary().
|
|
111
|
+
get_directory_name(Path, Acc, Segment) ->
|
|
112
|
+
case Path of
|
|
113
|
+
[<<"/"/utf8>> | Rest] ->
|
|
114
|
+
get_directory_name(
|
|
115
|
+
Rest,
|
|
116
|
+
<<Acc/binary, Segment/binary>>,
|
|
117
|
+
<<"/"/utf8>>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
[First | Rest@1] ->
|
|
121
|
+
get_directory_name(Rest@1, Acc, <<Segment/binary, First/binary>>);
|
|
122
|
+
|
|
123
|
+
[] ->
|
|
124
|
+
Acc
|
|
125
|
+
end.
|
|
126
|
+
|
|
127
|
+
-file("src/filepath.gleam", 259).
|
|
128
|
+
?DOC(
|
|
129
|
+
" Get the directory name of a path, that is the path without the file name.\n"
|
|
130
|
+
"\n"
|
|
131
|
+
" ## Examples\n"
|
|
132
|
+
"\n"
|
|
133
|
+
" ```gleam\n"
|
|
134
|
+
" directory_name(\"/usr/local/bin\")\n"
|
|
135
|
+
" // -> \"/usr/local\"\n"
|
|
136
|
+
" ```\n"
|
|
137
|
+
).
|
|
138
|
+
-spec directory_name(binary()) -> binary().
|
|
139
|
+
directory_name(Path) ->
|
|
140
|
+
Path@1 = remove_trailing_slash(Path),
|
|
141
|
+
case Path@1 of
|
|
142
|
+
<<"/"/utf8, Rest/binary>> ->
|
|
143
|
+
get_directory_name(
|
|
144
|
+
gleam@string:to_graphemes(Rest),
|
|
145
|
+
<<"/"/utf8>>,
|
|
146
|
+
<<""/utf8>>
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
_ ->
|
|
150
|
+
get_directory_name(
|
|
151
|
+
gleam@string:to_graphemes(Path@1),
|
|
152
|
+
<<""/utf8>>,
|
|
153
|
+
<<""/utf8>>
|
|
154
|
+
)
|
|
155
|
+
end.
|
|
156
|
+
|
|
157
|
+
-file("src/filepath.gleam", 294).
|
|
158
|
+
?DOC(
|
|
159
|
+
" Check if a path is absolute.\n"
|
|
160
|
+
"\n"
|
|
161
|
+
" ## Examples\n"
|
|
162
|
+
"\n"
|
|
163
|
+
" ```gleam\n"
|
|
164
|
+
" is_absolute(\"/usr/local/bin\")\n"
|
|
165
|
+
" // -> True\n"
|
|
166
|
+
" ```\n"
|
|
167
|
+
"\n"
|
|
168
|
+
" ```gleam\n"
|
|
169
|
+
" is_absolute(\"usr/local/bin\")\n"
|
|
170
|
+
" // -> False\n"
|
|
171
|
+
" ```\n"
|
|
172
|
+
).
|
|
173
|
+
-spec is_absolute(binary()) -> boolean().
|
|
174
|
+
is_absolute(Path) ->
|
|
175
|
+
gleam@string:starts_with(Path, <<"/"/utf8>>).
|
|
176
|
+
|
|
177
|
+
-file("src/filepath.gleam", 339).
|
|
178
|
+
-spec expand_segments(list(binary()), list(binary())) -> {ok, binary()} |
|
|
179
|
+
{error, nil}.
|
|
180
|
+
expand_segments(Path, Base) ->
|
|
181
|
+
case {Base, Path} of
|
|
182
|
+
{[<<""/utf8>>], [<<".."/utf8>> | _]} ->
|
|
183
|
+
{error, nil};
|
|
184
|
+
|
|
185
|
+
{[], [<<".."/utf8>> | _]} ->
|
|
186
|
+
{error, nil};
|
|
187
|
+
|
|
188
|
+
{[_ | Base@1], [<<".."/utf8>> | Path@1]} ->
|
|
189
|
+
expand_segments(Path@1, Base@1);
|
|
190
|
+
|
|
191
|
+
{_, [<<"."/utf8>> | Path@2]} ->
|
|
192
|
+
expand_segments(Path@2, Base);
|
|
193
|
+
|
|
194
|
+
{_, [S | Path@3]} ->
|
|
195
|
+
expand_segments(Path@3, [S | Base]);
|
|
196
|
+
|
|
197
|
+
{_, []} ->
|
|
198
|
+
{ok, gleam@string:join(lists:reverse(Base), <<"/"/utf8>>)}
|
|
199
|
+
end.
|
|
200
|
+
|
|
201
|
+
-file("src/filepath.gleam", 364).
|
|
202
|
+
-spec root_slash_to_empty(list(binary())) -> list(binary()).
|
|
203
|
+
root_slash_to_empty(Segments) ->
|
|
204
|
+
case Segments of
|
|
205
|
+
[<<"/"/utf8>> | Rest] ->
|
|
206
|
+
[<<""/utf8>> | Rest];
|
|
207
|
+
|
|
208
|
+
_ ->
|
|
209
|
+
Segments
|
|
210
|
+
end.
|
|
211
|
+
|
|
212
|
+
-file("src/filepath.gleam", 153).
|
|
213
|
+
-spec pop_windows_drive_specifier(binary()) -> {gleam@option:option(binary()),
|
|
214
|
+
binary()}.
|
|
215
|
+
pop_windows_drive_specifier(Path) ->
|
|
216
|
+
Start = gleam@string:slice(Path, 0, 3),
|
|
217
|
+
Codepoints = gleam@string:to_utf_codepoints(Start),
|
|
218
|
+
case gleam@list:map(Codepoints, fun gleam@string:utf_codepoint_to_int/1) of
|
|
219
|
+
[Drive, Colon, Slash] when (((Slash =:= 47) orelse (Slash =:= 92)) andalso (Colon =:= 58)) andalso (((Drive >= 65) andalso (Drive =< 90)) orelse ((Drive >= 97) andalso (Drive =< 122))) ->
|
|
220
|
+
Drive_letter = gleam@string:slice(Path, 0, 1),
|
|
221
|
+
Drive@1 = <<(gleam@string:lowercase(Drive_letter))/binary,
|
|
222
|
+
":/"/utf8>>,
|
|
223
|
+
Path@1 = gleam@string:drop_start(Path, 3),
|
|
224
|
+
{{some, Drive@1}, Path@1};
|
|
225
|
+
|
|
226
|
+
_ ->
|
|
227
|
+
{none, Path}
|
|
228
|
+
end.
|
|
229
|
+
|
|
230
|
+
-file("src/filepath.gleam", 120).
|
|
231
|
+
?DOC(
|
|
232
|
+
" Split a path into its segments, using `/` and `\\` as the path separators. If\n"
|
|
233
|
+
" there is a drive letter at the start of the path then it is lowercased.\n"
|
|
234
|
+
"\n"
|
|
235
|
+
" Typically you would want to use `split` instead of this function, but if you\n"
|
|
236
|
+
" want Windows path behaviour on a non-Windows system then you can use this\n"
|
|
237
|
+
" function.\n"
|
|
238
|
+
"\n"
|
|
239
|
+
" ## Examples\n"
|
|
240
|
+
"\n"
|
|
241
|
+
" ```gleam\n"
|
|
242
|
+
" split(\"/usr/local/bin\", \"bin\")\n"
|
|
243
|
+
" // -> [\"/\", \"usr\", \"local\", \"bin\"]\n"
|
|
244
|
+
" ```\n"
|
|
245
|
+
).
|
|
246
|
+
-spec split_windows(binary()) -> list(binary()).
|
|
247
|
+
split_windows(Path) ->
|
|
248
|
+
{Drive, Path@1} = pop_windows_drive_specifier(Path),
|
|
249
|
+
Segments = begin
|
|
250
|
+
_pipe = gleam@string:split(Path@1, <<"/"/utf8>>),
|
|
251
|
+
gleam@list:flat_map(
|
|
252
|
+
_pipe,
|
|
253
|
+
fun(_capture) -> gleam@string:split(_capture, <<"\\"/utf8>>) end
|
|
254
|
+
)
|
|
255
|
+
end,
|
|
256
|
+
Segments@1 = case Drive of
|
|
257
|
+
{some, Drive@1} ->
|
|
258
|
+
[Drive@1 | Segments];
|
|
259
|
+
|
|
260
|
+
none ->
|
|
261
|
+
Segments
|
|
262
|
+
end,
|
|
263
|
+
case Segments@1 of
|
|
264
|
+
[<<""/utf8>>] ->
|
|
265
|
+
[];
|
|
266
|
+
|
|
267
|
+
[<<""/utf8>> | Rest] ->
|
|
268
|
+
[<<"/"/utf8>> | Rest];
|
|
269
|
+
|
|
270
|
+
Rest@1 ->
|
|
271
|
+
Rest@1
|
|
272
|
+
end.
|
|
273
|
+
|
|
274
|
+
-file("src/filepath.gleam", 77).
|
|
275
|
+
?DOC(
|
|
276
|
+
" Split a path into its segments.\n"
|
|
277
|
+
"\n"
|
|
278
|
+
" When running on Windows both `/` and `\\` are treated as path separators, and \n"
|
|
279
|
+
" if the path starts with a drive letter then the drive letter then it is\n"
|
|
280
|
+
" lowercased.\n"
|
|
281
|
+
"\n"
|
|
282
|
+
" ## Examples\n"
|
|
283
|
+
"\n"
|
|
284
|
+
" ```gleam\n"
|
|
285
|
+
" split(\"/usr/local/bin\", \"bin\")\n"
|
|
286
|
+
" // -> [\"/\", \"usr\", \"local\", \"bin\"]\n"
|
|
287
|
+
" ```\n"
|
|
288
|
+
).
|
|
289
|
+
-spec split(binary()) -> list(binary()).
|
|
290
|
+
split(Path) ->
|
|
291
|
+
case filepath_ffi:is_windows() of
|
|
292
|
+
true ->
|
|
293
|
+
split_windows(Path);
|
|
294
|
+
|
|
295
|
+
false ->
|
|
296
|
+
split_unix(Path)
|
|
297
|
+
end.
|
|
298
|
+
|
|
299
|
+
-file("src/filepath.gleam", 240).
|
|
300
|
+
?DOC(
|
|
301
|
+
" Get the base name of a path, that is the name of the file without the\n"
|
|
302
|
+
" containing directory.\n"
|
|
303
|
+
"\n"
|
|
304
|
+
" ## Examples\n"
|
|
305
|
+
"\n"
|
|
306
|
+
" ```gleam\n"
|
|
307
|
+
" base_name(\"/usr/local/bin\")\n"
|
|
308
|
+
" // -> \"bin\"\n"
|
|
309
|
+
" ```\n"
|
|
310
|
+
).
|
|
311
|
+
-spec base_name(binary()) -> binary().
|
|
312
|
+
base_name(Path) ->
|
|
313
|
+
gleam@bool:guard(Path =:= <<"/"/utf8>>, <<""/utf8>>, fun() -> _pipe = Path,
|
|
314
|
+
_pipe@1 = split(_pipe),
|
|
315
|
+
_pipe@2 = gleam@list:last(_pipe@1),
|
|
316
|
+
gleam@result:unwrap(_pipe@2, <<""/utf8>>) end).
|
|
317
|
+
|
|
318
|
+
-file("src/filepath.gleam", 190).
|
|
319
|
+
?DOC(
|
|
320
|
+
" Get the file extension of a path.\n"
|
|
321
|
+
"\n"
|
|
322
|
+
" ## Examples\n"
|
|
323
|
+
"\n"
|
|
324
|
+
" ```gleam\n"
|
|
325
|
+
" extension(\"src/main.gleam\")\n"
|
|
326
|
+
" // -> Ok(\"gleam\")\n"
|
|
327
|
+
" ```\n"
|
|
328
|
+
"\n"
|
|
329
|
+
" ```gleam\n"
|
|
330
|
+
" extension(\"package.tar.gz\")\n"
|
|
331
|
+
" // -> Ok(\"gz\")\n"
|
|
332
|
+
" ```\n"
|
|
333
|
+
).
|
|
334
|
+
-spec extension(binary()) -> {ok, binary()} | {error, nil}.
|
|
335
|
+
extension(Path) ->
|
|
336
|
+
File = base_name(Path),
|
|
337
|
+
case gleam@string:split(File, <<"."/utf8>>) of
|
|
338
|
+
[<<""/utf8>>, _] ->
|
|
339
|
+
{error, nil};
|
|
340
|
+
|
|
341
|
+
[_, Extension] ->
|
|
342
|
+
{ok, Extension};
|
|
343
|
+
|
|
344
|
+
[_ | Rest] ->
|
|
345
|
+
gleam@list:last(Rest);
|
|
346
|
+
|
|
347
|
+
_ ->
|
|
348
|
+
{error, nil}
|
|
349
|
+
end.
|
|
350
|
+
|
|
351
|
+
-file("src/filepath.gleam", 219).
|
|
352
|
+
?DOC(
|
|
353
|
+
" Remove the extension from a file, if it has any.\n"
|
|
354
|
+
" \n"
|
|
355
|
+
" ## Examples\n"
|
|
356
|
+
" \n"
|
|
357
|
+
" ```gleam\n"
|
|
358
|
+
" strip_extension(\"src/main.gleam\")\n"
|
|
359
|
+
" // -> \"src/main\"\n"
|
|
360
|
+
" ```\n"
|
|
361
|
+
" \n"
|
|
362
|
+
" ```gleam\n"
|
|
363
|
+
" strip_extension(\"package.tar.gz\")\n"
|
|
364
|
+
" // -> \"package.tar\"\n"
|
|
365
|
+
" ```\n"
|
|
366
|
+
" \n"
|
|
367
|
+
" ```gleam\n"
|
|
368
|
+
" strip_extension(\"src/gleam\")\n"
|
|
369
|
+
" // -> \"src/gleam\"\n"
|
|
370
|
+
" ```\n"
|
|
371
|
+
).
|
|
372
|
+
-spec strip_extension(binary()) -> binary().
|
|
373
|
+
strip_extension(Path) ->
|
|
374
|
+
case extension(Path) of
|
|
375
|
+
{ok, Extension} ->
|
|
376
|
+
gleam@string:drop_end(Path, gleam@string:length(Extension) + 1);
|
|
377
|
+
|
|
378
|
+
{error, nil} ->
|
|
379
|
+
Path
|
|
380
|
+
end.
|
|
381
|
+
|
|
382
|
+
-file("src/filepath.gleam", 324).
|
|
383
|
+
?DOC(
|
|
384
|
+
" Expand `..` and `.` segments in a path.\n"
|
|
385
|
+
"\n"
|
|
386
|
+
" If the path has a `..` segment that would go up past the root of the path\n"
|
|
387
|
+
" then an error is returned. This may be useful to example to ensure that a\n"
|
|
388
|
+
" path specified by a user does not go outside of a directory.\n"
|
|
389
|
+
"\n"
|
|
390
|
+
" If the path is absolute then the result will always be absolute.\n"
|
|
391
|
+
"\n"
|
|
392
|
+
" ## Examples\n"
|
|
393
|
+
"\n"
|
|
394
|
+
" ```gleam\n"
|
|
395
|
+
" expand(\"/usr/local/../bin\")\n"
|
|
396
|
+
" // -> Ok(\"/usr/bin\")\n"
|
|
397
|
+
" ```\n"
|
|
398
|
+
"\n"
|
|
399
|
+
" ```gleam\n"
|
|
400
|
+
" expand(\"/tmp/../..\")\n"
|
|
401
|
+
" // -> Error(Nil)\n"
|
|
402
|
+
" ```\n"
|
|
403
|
+
"\n"
|
|
404
|
+
" ```gleam\n"
|
|
405
|
+
" expand(\"src/../..\")\n"
|
|
406
|
+
" // -> Error(\"..\")\n"
|
|
407
|
+
" ```\n"
|
|
408
|
+
).
|
|
409
|
+
-spec expand(binary()) -> {ok, binary()} | {error, nil}.
|
|
410
|
+
expand(Path) ->
|
|
411
|
+
Is_absolute = is_absolute(Path),
|
|
412
|
+
Result = begin
|
|
413
|
+
_pipe = Path,
|
|
414
|
+
_pipe@1 = split(_pipe),
|
|
415
|
+
_pipe@2 = root_slash_to_empty(_pipe@1),
|
|
416
|
+
_pipe@3 = expand_segments(_pipe@2, []),
|
|
417
|
+
gleam@result:map(_pipe@3, fun remove_trailing_slash/1)
|
|
418
|
+
end,
|
|
419
|
+
case Is_absolute andalso (Result =:= {ok, <<""/utf8>>}) of
|
|
420
|
+
true ->
|
|
421
|
+
{ok, <<"/"/utf8>>};
|
|
422
|
+
|
|
423
|
+
false ->
|
|
424
|
+
Result
|
|
425
|
+
end.
|