├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── ROADMAP.md ├── docs ├── Node.Buffer.md ├── Node.ChildProcess.md ├── Node.Crypto.md ├── Node.Encoding.md ├── Node.Error.md ├── Node.FileSystem.md ├── Node.Global.md ├── Node.OperatingSystem.md ├── Node.Path.md └── Node.Process.md ├── documentation.json ├── elm-package.json ├── package-lock.json ├── package.json ├── src ├── Native │ ├── Buffer.js │ ├── ChildProcess.js │ ├── Crypto.js │ ├── FileSystem.js │ ├── Global.js │ ├── OperatingSystem.js │ ├── Path.js │ └── Process.js └── Node │ ├── Buffer.elm │ ├── Buffer │ └── LowLevel.elm │ ├── ChildProcess.elm │ ├── ChildProcess │ └── LowLevel.elm │ ├── Crypto.elm │ ├── Crypto │ └── LowLevel.elm │ ├── Encoding.elm │ ├── Error.elm │ ├── FileSystem.elm │ ├── FileSystem │ └── LowLevel.elm │ ├── Global.elm │ ├── Global │ └── LowLevel.elm │ ├── OperatingSystem.elm │ ├── OperatingSystem │ └── LowLevel.elm │ ├── Path.elm │ ├── Process.elm │ └── Process │ └── LowLevel.elm └── test ├── Buffer ├── Main.elm └── index.js ├── ChildProcess ├── Main.elm └── index.js ├── Crypto ├── Main.elm └── index.js ├── FileSystem ├── Main.elm └── index.js ├── Global ├── Main.elm └── index.js ├── OperatingSystem ├── Main.elm └── index.js ├── Path ├── Main.elm └── index.js └── Process ├── Main.elm └── index.js /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "elm" 3 | }; 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | elm-stuff 2 | node_modules 3 | test/**/main.js 4 | test/FileSystem/output.* 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Node core 2 | 3 | > Support for the Node.js runtime environment. 4 | 5 | Node: `v8.x` 6 | 7 | In accordance with Elm best practices, this package strives for: 8 | - No runtime exceptions 9 | - Enforced semantic versioning 10 | 11 | 12 | ## Install 13 | 14 | ```sh 15 | grove install elm-node/core 16 | ``` 17 | 18 | _Note: [Grove](https://github.com/panosoft/elm-grove) is an advanced package manager for Elm and can be found [here](https://github.com/panosoft/elm-grove)._ 19 | 20 | 21 | ## Documentation 22 | 23 | Complete api documentation can be found in the [./docs](./docs) directory. 24 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | ## FileSystem 4 | - [ ] appendFile 5 | - [ ] open : FileDescriptor -> 6 | - [ ] close : FileDescriptor -> 7 | - [ ] flush : FileDescriptor -> 8 | - [ ] append : FileDescriptor -> 9 | - [ ] read : FileDescriptor -> 10 | - [ ] write : FileDescriptor -> 11 | - [ ] readdir (list) 12 | 13 | ## Buffer 14 | - [-] concat 15 | - [-] slice 16 | 17 | ## Process 18 | - [-] versions (i.e. node and it's internal dependency versions) 19 | 20 | ## OperatingSystem 21 | - [-] hostname 22 | --- 23 | - [-] architecture 24 | - [-] processors 25 | - [-] freeMemory 26 | - [-] totalMemory 27 | - [-] networkInterfaces 28 | --- 29 | - [-] platform 30 | - [-] release (i.e. os version) 31 | --- 32 | - [-] username 33 | -------------------------------------------------------------------------------- /docs/Node.Buffer.md: -------------------------------------------------------------------------------- 1 | # Node.Buffer 2 | 3 | Native bindings for Buffer module. 4 | 5 | - [Buffer](#buffer) 6 | - [fromString](#fromstring) 7 | - [toString](#tostring) 8 | 9 | ### **type alias Buffer** 10 | ```elm 11 | type alias Buffer = 12 | Node.Buffer.LowLevel.Buffer 13 | ``` 14 | 15 | Buffer type. 16 | 17 | --- 18 | 19 | ### **fromString** 20 | ```elm 21 | fromString : Node.Encoding.Encoding -> String -> Result Node.Error.Error Node.Buffer.Buffer 22 | ``` 23 | 24 | Convert a String to a Buffer. 25 | 26 | --- 27 | 28 | ### **toString** 29 | ```elm 30 | toString : Node.Encoding.Encoding -> Node.Buffer.Buffer -> Result Node.Error.Error String 31 | ``` 32 | 33 | Convert a Buffer to a String. 34 | 35 | -------------------------------------------------------------------------------- /docs/Node.ChildProcess.md: -------------------------------------------------------------------------------- 1 | # Node.ChildProcess 2 | 3 | Child Process 4 | 5 | - [Output](#output) 6 | - [Exit](#exit) 7 | - [spawn](#spawn) 8 | 9 | ### **type Output** 10 | ```elm 11 | type Output 12 | = Silent 13 | | Verbose 14 | ``` 15 | 16 | Output type. 17 | 18 | --- 19 | 20 | ### **type Exit** 21 | ```elm 22 | type Exit 23 | = Code Int 24 | | Signal String 25 | ``` 26 | 27 | Exit type. 28 | 29 | --- 30 | 31 | ### **spawn** 32 | ```elm 33 | spawn : String -> Node.ChildProcess.Output -> Task Node.Error.Error Node.ChildProcess.Exit 34 | ``` 35 | 36 | Spawn a child process by running the given command. 37 | 38 | -------------------------------------------------------------------------------- /docs/Node.Crypto.md: -------------------------------------------------------------------------------- 1 | # Node.Crypto 2 | 3 | Native bindings for Node's Crypto module. 4 | 5 | - [Cipher](#cipher) 6 | - [decrypt](#decrypt) 7 | - [encrypt](#encrypt) 8 | - [randomBytes](#randombytes) 9 | 10 | ### **type Cipher** 11 | ```elm 12 | type Cipher 13 | = Aes128 14 | | Aes128CipherBlockChaining 15 | | Aes128CipherFeedback 16 | | Aes128CipherFeedback1 17 | | Aes128CipherFeedback8 18 | | Aes128ElectronicCookbook 19 | | Aes128OutputFeedback 20 | | Aes192 21 | | Aes192CipherBlockChaining 22 | | Aes192CipherFeedback 23 | | Aes192CipherFeedback1 24 | | Aes192CipherFeedback8 25 | | Aes192ElectronicCookbook 26 | | Aes192OutputFeedback 27 | | Aes256 28 | | Aes256CipherBlockChaining 29 | | Aes256CipherFeedback 30 | | Aes256CipherFeedback1 31 | | Aes256CipherFeedback8 32 | | Aes256ElectronicCookbook 33 | | Aes256OutputFeedback 34 | | Base64 35 | | Bf 36 | | BfCipherBlockChaining 37 | | BfCipherFeedback 38 | | BfElectronicCookbook 39 | | BfOutputFeedback 40 | | Cast 41 | | CastCipherBlockChaining 42 | | Cast5CipherBlockChaining 43 | | Cast5CipherFeedback 44 | | Cast5ElectronicCookbook 45 | | Cast5OutputFeedback 46 | | Des 47 | | DesCipherBlockChaining 48 | | DesCipherFeedback 49 | | DesElectronicCookbook 50 | | DesOutputFeedback 51 | | DesEde 52 | | DesEdeCipherBlockChaining 53 | | DesEdeCipherFeedback 54 | | DesEdeOutputFeedback 55 | | Des3 56 | | DesEde3 57 | | DesEde3CipherBlockChaining 58 | | DesEde3CipherFeedback 59 | | DesEde3OutputFeedback 60 | | Desx 61 | | Gost89 62 | | Gost89CNT 63 | | Idea 64 | | IdeaCipherBlockChaining 65 | | IdeaCipherFeedback 66 | | IdeaElectronicCookbook 67 | | IdeaOutputFeedback 68 | | Rc2 69 | | Rc2CipherBlockChaining 70 | | Rc2CipherFeedback 71 | | Rc2ElectronicCookbook 72 | | Rc2OutputFeedback 73 | | Rc240CipherBlockChaining 74 | | Rc264CipherBlockChaining 75 | | Rc4 76 | | Rc440 77 | | Rc464 78 | | Rc5 79 | | Rc5CipherBlockChaining 80 | | Rc5CipherFeedback 81 | | Rc5ElectronicCookbook 82 | | Rc5OutputFeedback 83 | | None 84 | ``` 85 | 86 | Cipher types supported by [Openssl](https://www.openssl.org/docs/man1.0.2/apps/enc.html). 87 | 88 | --- 89 | 90 | ### **decrypt** 91 | ```elm 92 | decrypt : Node.Crypto.Cipher -> String -> Node.Buffer.Buffer -> Result Node.Error.Error Node.Buffer.Buffer 93 | ``` 94 | 95 | Decrypt a Buffer. 96 | 97 | --- 98 | 99 | ### **encrypt** 100 | ```elm 101 | encrypt : Node.Crypto.Cipher -> String -> Node.Buffer.Buffer -> Result Node.Error.Error Node.Buffer.Buffer 102 | ``` 103 | 104 | Encrypt a Buffer. 105 | 106 | --- 107 | 108 | ### **randomBytes** 109 | ```elm 110 | randomBytes : Int -> Task Node.Error.Error Node.Buffer.Buffer 111 | ``` 112 | 113 | Generate cryptographically strong pseudo-random data. 114 | 115 | -------------------------------------------------------------------------------- /docs/Node.Encoding.md: -------------------------------------------------------------------------------- 1 | # Node.Encoding 2 | 3 | String encodings supported by Node.js. 4 | 5 | - [Encoding](#encoding) 6 | - [toString](#tostring) 7 | 8 | ### **type Encoding** 9 | ```elm 10 | type Encoding 11 | = Ascii 12 | | Utf8 13 | | Utf16le 14 | | Base64 15 | | Latin1 16 | | Hex 17 | ``` 18 | 19 | Encoding union type. 20 | 21 | --- 22 | 23 | ### **toString** 24 | ```elm 25 | toString : Node.Encoding.Encoding -> String 26 | ``` 27 | 28 | Convert encoding to string. 29 | 30 | -------------------------------------------------------------------------------- /docs/Node.Error.md: -------------------------------------------------------------------------------- 1 | # Node.Error 2 | 3 | Error type. 4 | 5 | - [Error](#error) 6 | - [message](#message) 7 | - [decoder](#decoder) 8 | - [fromValue](#fromvalue) 9 | - [Code](#code) 10 | 11 | ### **type Error** 12 | ```elm 13 | type Error 14 | = Error String String 15 | | SystemError Node.Error.Code { message : String , stack : String , syscall : String , path : Maybe String , address : Maybe String , port_ : Maybe String } 16 | ``` 17 | 18 | Error union type. 19 | 20 | --- 21 | 22 | ### **message** 23 | ```elm 24 | message : Node.Error.Error -> String 25 | ``` 26 | 27 | Extract the message from an Error. 28 | 29 | --- 30 | 31 | ### **decoder** 32 | ```elm 33 | decoder : Json.Decode.Decoder Node.Error.Error 34 | ``` 35 | 36 | Error decoder. 37 | 38 | --- 39 | 40 | ### **fromValue** 41 | ```elm 42 | fromValue : Json.Decode.Value -> Node.Error.Error 43 | ``` 44 | 45 | Decode an Error from a Value. 46 | 47 | --- 48 | 49 | ### **type Code** 50 | ```elm 51 | type Code 52 | = ArgumentListTooLong 53 | | PermissionDenied 54 | | AddressInUse 55 | | AddressNotAvailable 56 | | AddressFamilyNotSupported 57 | | ResourceTemporarilyUnavailable 58 | | ConnectionAlreadyInProgress 59 | | InvalidExchange 60 | | BadFileDescriptor 61 | | FileDescriptorInBadState 62 | | BadMessage 63 | | InvalidRequestDescriptor 64 | | InvalidRequestCode 65 | | InvalidSlot 66 | | DeviceOrResourceBusy 67 | | OperationCancelled 68 | | NoChildProcesses 69 | | ChannelNumberOutOfRange 70 | | CommunicationErrorOnSend 71 | | ConnectionAborted 72 | | ConnectionRefused 73 | | ConnectionReset 74 | | ResourceDeadlockAvoided 75 | | DestinationAddressRequired 76 | | ArgumentOutOfDomain 77 | | DiskQuotaExceeded 78 | | FileExists 79 | | BadAddress 80 | | FileTooLarge 81 | | HostDown 82 | | HostUnreachable 83 | | IdentifierRemoved 84 | | IllegalByteSequence 85 | | OperationInProgress 86 | | InteruptedFunctionCall 87 | | InvalidArgument 88 | | InputOutput 89 | | SocketConnected 90 | | IsADirectory 91 | | NamedTypeFile 92 | | KeyExpired 93 | | KeyRejected 94 | | KeyRevoked 95 | | Level2Halted 96 | | Level2NotSynchronized 97 | | Level3Halted 98 | | CannotAccessLibrary 99 | | LibraryCorrupted 100 | | TooManyLibraries 101 | | LibSectionCorrupted 102 | | CannotExecuteLibrary 103 | | TooManyLevelsOfSymbolicLinks 104 | | WrongMediumType 105 | | TooManyOpenFiles 106 | | TooManyLinks 107 | | MessageTooLong 108 | | MultihopAttempted 109 | | FilenameTooLong 110 | | NetworkDown 111 | | ConnectionAbortedByNetwork 112 | | NetworkUnreachable 113 | | NoBufferSpaceAvailable 114 | | NoDataAvailable 115 | | NoDevice 116 | | NoSuchFileOrDirectory 117 | | ExecuteFormatError 118 | | RequiredKeyNotAvailable 119 | | NoLocksAvailable 120 | | NoLink 121 | | NoMedium 122 | | NotEnoughSpace 123 | | NoMessage 124 | | NotOnNetwork 125 | | PackageNotInstalled 126 | | ProtocolNotAvailable 127 | | NoStreamResources 128 | | NotStream 129 | | FunctionNotImplemented 130 | | BlockDeviceRequired 131 | | SocketNotConnected 132 | | NotADirectory 133 | | DirectoryNotEmpty 134 | | NotSocket 135 | | OperationNotSupported 136 | | InappropriateIOControlOperation 137 | | NameNotUniqueOnNetwork 138 | | NoDeviceOrAddress 139 | | OperationNotSupportedOnSocket 140 | | ValueTooLarge 141 | | OperationNotPermitted 142 | | ProtocolFamilyNotAvailable 143 | | BrokenPipe 144 | | Protocol 145 | | ProtocolNotSupported 146 | | WrongProtocolForSocket 147 | | ResultTooLarge 148 | | RemoteAddressChanged 149 | | ObjectRemote 150 | | RemoteIO 151 | | RestartCall 152 | | ReadOnlyFileSystem 153 | | TransportEndpointShutdown 154 | | InvalidSeek 155 | | SocketNotSupported 156 | | NoProcess 157 | | StaleFileHandle 158 | | StreamPipe 159 | | TimerExpired 160 | | ConnectionTimedOut 161 | | TextFileBusy 162 | | StructureNeedsCleaning 163 | | ProtocolDriverNotAttached 164 | | TooManyUsers 165 | | OperationWouldBlock 166 | | ImproperLink 167 | | ExchangeFull 168 | ``` 169 | 170 | Error code union type. 171 | 172 | -------------------------------------------------------------------------------- /docs/Node.FileSystem.md: -------------------------------------------------------------------------------- 1 | # Node.FileSystem 2 | 3 | FileSystem 4 | 5 | - [defaultEncoding](#defaultencoding) 6 | - [defaultMode](#defaultmode) 7 | 8 | ### **defaultEncoding** 9 | ```elm 10 | defaultEncoding : Node.Encoding.Encoding 11 | ``` 12 | 13 | Default encoding (Utf8). 14 | 15 | --- 16 | 17 | ### **defaultMode** 18 | ```elm 19 | defaultMode : Node.FileSystem.Mode 20 | ``` 21 | 22 | Default mode (Read and Write access for Owner, Group, and Others). 23 | 24 | 25 | ## Query 26 | 27 | - [Stats](#stats) 28 | - [FileType](#filetype) 29 | - [exists](#exists) 30 | - [statistics](#statistics) 31 | 32 | ### **type alias Stats** 33 | ```elm 34 | type alias Stats = 35 | { type_ : Node.FileSystem.FileType , size : Int , mode : Node.FileSystem.Mode , accessed : Time , modified : Time , changed : Time , created : Time } 36 | ``` 37 | 38 | Path statistics. 39 | 40 | --- 41 | 42 | ### **type FileType** 43 | ```elm 44 | type FileType 45 | = File 46 | | Directory 47 | | Socket 48 | | SymbolicLink 49 | ``` 50 | 51 | Path types. 52 | 53 | --- 54 | 55 | ### **exists** 56 | ```elm 57 | exists : String -> Task Node.Error.Error Bool 58 | ``` 59 | 60 | Check whether a path exists. 61 | 62 | --- 63 | 64 | ### **statistics** 65 | ```elm 66 | statistics : String -> Task Node.Error.Error Node.FileSystem.Stats 67 | ``` 68 | 69 | Get statistics for a given path. 70 | 71 | 72 | ## Manage 73 | 74 | - [copy](#copy) 75 | - [mkdirp](#mkdirp) 76 | - [remove](#remove) 77 | - [rename](#rename) 78 | - [symbolicLink](#symboliclink) 79 | 80 | ### **copy** 81 | ```elm 82 | copy : Bool -> String -> String -> Task Node.Error.Error (Dict String (Result Node.Error.Error ())) 83 | ``` 84 | 85 | Copy a file or directory recursively. 86 | 87 | --- 88 | 89 | ### **mkdirp** 90 | ```elm 91 | mkdirp : String -> Task Node.Error.Error () 92 | ``` 93 | 94 | Make a directory using the given directory name. 95 | 96 | Non-existent directories in the path will be created. 97 | 98 | --- 99 | 100 | ### **remove** 101 | ```elm 102 | remove : String -> Task Node.Error.Error () 103 | ``` 104 | 105 | Remove a file or directory recursively. 106 | 107 | --- 108 | 109 | ### **rename** 110 | ```elm 111 | rename : String -> String -> Task Node.Error.Error () 112 | ``` 113 | 114 | Rename a file. 115 | 116 | --- 117 | 118 | ### **symbolicLink** 119 | ```elm 120 | symbolicLink : String -> String -> Task Node.Error.Error () 121 | ``` 122 | 123 | Make a symbolic link. 124 | 125 | 126 | ## Read 127 | 128 | - [readFile](#readfile) 129 | - [readFileAsString](#readfileasstring) 130 | 131 | ### **readFile** 132 | ```elm 133 | readFile : String -> Task Node.Error.Error Node.Buffer.Buffer 134 | ``` 135 | 136 | Read a file as a Buffer. 137 | 138 | --- 139 | 140 | ### **readFileAsString** 141 | ```elm 142 | readFileAsString : String -> Node.Encoding.Encoding -> Task Node.Error.Error String 143 | ``` 144 | 145 | Read a file as a string. 146 | 147 | 148 | ## Write 149 | 150 | - [writeFile](#writefile) 151 | - [writeFileFromString](#writefilefromstring) 152 | 153 | ### **writeFile** 154 | ```elm 155 | writeFile : String -> Node.FileSystem.Mode -> Node.Buffer.Buffer -> Task Node.Error.Error () 156 | ``` 157 | 158 | Write a file from a Buffer. 159 | 160 | Non-existent directories in the filename path will be created. 161 | 162 | --- 163 | 164 | ### **writeFileFromString** 165 | ```elm 166 | writeFileFromString : String -> Node.FileSystem.Mode -> Node.Encoding.Encoding -> String -> Task Node.Error.Error () 167 | ``` 168 | 169 | Write a file from a String. 170 | 171 | Non-existent directories in the file's path will be created. 172 | 173 | -------------------------------------------------------------------------------- /docs/Node.Global.md: -------------------------------------------------------------------------------- 1 | # Node.Global 2 | 3 | Global functions 4 | 5 | - [intToString](#inttostring) 6 | - [stringToInt](#stringtoint) 7 | 8 | ### **intToString** 9 | ```elm 10 | intToString : Int -> Int -> Result Node.Error.Error String 11 | ``` 12 | 13 | Convert an integer into a string using the specified radix. 14 | 15 | --- 16 | 17 | ### **stringToInt** 18 | ```elm 19 | stringToInt : Int -> String -> Result Node.Error.Error Int 20 | ``` 21 | 22 | Convert a string into an integer using the specified radix. 23 | 24 | -------------------------------------------------------------------------------- /docs/Node.OperatingSystem.md: -------------------------------------------------------------------------------- 1 | # Node.OperatingSystem 2 | 3 | Operating system information. 4 | 5 | - [Platform](#platform) 6 | - [homeDirectory](#homedirectory) 7 | - [platform](#platform-1) 8 | - [tempDirectory](#tempdirectory) 9 | 10 | ### **type Platform** 11 | ```elm 12 | type Platform 13 | = Aix 14 | | Android 15 | | Darwin 16 | | FreeBsd 17 | | Linux 18 | | OpenBsd 19 | | SunOs 20 | | Windows 21 | ``` 22 | 23 | Platforms supported by Node.js. 24 | 25 | --- 26 | 27 | ### **homeDirectory** 28 | ```elm 29 | homeDirectory : String 30 | ``` 31 | 32 | Current user's home directory. 33 | 34 | --- 35 | 36 | ### **platform** 37 | ```elm 38 | platform : Result Node.Error.Error Node.OperatingSystem.Platform 39 | ``` 40 | 41 | Platform set at compile time of current running version of Node.js. 42 | 43 | --- 44 | 45 | ### **tempDirectory** 46 | ```elm 47 | tempDirectory : String 48 | ``` 49 | 50 | Current user's temporary directory. 51 | 52 | -------------------------------------------------------------------------------- /docs/Node.Path.md: -------------------------------------------------------------------------------- 1 | # Node.Path 2 | 3 | Path 4 | 5 | - [basename](#basename) 6 | - [delimiter](#delimiter) 7 | - [dirname](#dirname) 8 | - [extname](#extname) 9 | - [join](#join) 10 | - [separator](#separator) 11 | 12 | ### **basename** 13 | ```elm 14 | basename : String -> String 15 | ``` 16 | 17 | Extract the basename from a filename. 18 | 19 | --- 20 | 21 | ### **delimiter** 22 | ```elm 23 | delimiter : String 24 | ``` 25 | 26 | The platform-specific path delimiter. 27 | 28 | --- 29 | 30 | ### **dirname** 31 | ```elm 32 | dirname : String -> String 33 | ``` 34 | 35 | Extract the directory name from a filename. 36 | 37 | --- 38 | 39 | ### **extname** 40 | ```elm 41 | extname : String -> String 42 | ``` 43 | 44 | Extract the extension name from a filename. 45 | 46 | --- 47 | 48 | ### **join** 49 | ```elm 50 | join : List String -> String 51 | ``` 52 | 53 | Build a path from the list of supplied strings 54 | 55 | --- 56 | 57 | ### **separator** 58 | ```elm 59 | separator : String 60 | ``` 61 | 62 | The platform-specific path segment separator. 63 | 64 | -------------------------------------------------------------------------------- /docs/Node.Process.md: -------------------------------------------------------------------------------- 1 | # Node.Process 2 | 3 | Process 4 | 5 | - [cwd](#cwd) 6 | - [environment](#environment) 7 | 8 | ### **cwd** 9 | ```elm 10 | cwd : () -> Task Node.Error.Error String 11 | ``` 12 | 13 | Current working directory. 14 | 15 | --- 16 | 17 | ### **environment** 18 | ```elm 19 | environment : Result String (Dict String String) 20 | ``` 21 | 22 | Environment variables. 23 | 24 | -------------------------------------------------------------------------------- /documentation.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Node.FileSystem", 4 | "comment": " FileSystem\n\n@docs defaultEncoding , defaultMode\n\n\n## Query\n\n@docs Stats , FileType , exists , statistics\n\n\n## Manage\n\n@docs copy , mkdirp , remove , rename , symbolicLink\n\n\n## Read\n\n@docs readFile , readFileAsString\n\n\n## Write\n\n@docs writeFile , writeFileFromString\n\n", 5 | "aliases": [ 6 | { 7 | "name": "Stats", 8 | "comment": " Path statistics.\n", 9 | "args": [], 10 | "type": "{ type_ : Node.FileSystem.FileType , size : Int , mode : Node.FileSystem.Mode , accessed : Time.Time , modified : Time.Time , changed : Time.Time , created : Time.Time }" 11 | } 12 | ], 13 | "types": [ 14 | { 15 | "name": "FileType", 16 | "comment": " Path types.\n", 17 | "args": [], 18 | "cases": [ 19 | [ 20 | "File", 21 | [] 22 | ], 23 | [ 24 | "Directory", 25 | [] 26 | ], 27 | [ 28 | "Socket", 29 | [] 30 | ], 31 | [ 32 | "SymbolicLink", 33 | [] 34 | ] 35 | ] 36 | } 37 | ], 38 | "values": [ 39 | { 40 | "name": "copy", 41 | "comment": " Copy a file or directory recursively.\n", 42 | "type": "Bool -> String -> String -> Task.Task Node.Error.Error (Dict.Dict String (Result.Result Node.Error.Error ()))" 43 | }, 44 | { 45 | "name": "defaultEncoding", 46 | "comment": " Default encoding (Utf8).\n", 47 | "type": "Node.Encoding.Encoding" 48 | }, 49 | { 50 | "name": "defaultMode", 51 | "comment": " Default mode (Read and Write access for Owner, Group, and Others).\n", 52 | "type": "Node.FileSystem.Mode" 53 | }, 54 | { 55 | "name": "exists", 56 | "comment": " Check whether a path exists.\n", 57 | "type": "String -> Task.Task Node.Error.Error Bool" 58 | }, 59 | { 60 | "name": "mkdirp", 61 | "comment": " Make a directory using the given directory name.\n\nNon-existent directories in the path will be created.\n\n", 62 | "type": "String -> Task.Task Node.Error.Error ()" 63 | }, 64 | { 65 | "name": "readFile", 66 | "comment": " Read a file as a Buffer.\n", 67 | "type": "String -> Task.Task Node.Error.Error Node.Buffer.Buffer" 68 | }, 69 | { 70 | "name": "readFileAsString", 71 | "comment": " Read a file as a string.\n", 72 | "type": "String -> Node.Encoding.Encoding -> Task.Task Node.Error.Error String" 73 | }, 74 | { 75 | "name": "remove", 76 | "comment": " Remove a file or directory recursively.\n", 77 | "type": "String -> Task.Task Node.Error.Error ()" 78 | }, 79 | { 80 | "name": "rename", 81 | "comment": " Rename a file.\n", 82 | "type": "String -> String -> Task.Task Node.Error.Error ()" 83 | }, 84 | { 85 | "name": "statistics", 86 | "comment": " Get statistics for a given path.\n", 87 | "type": "String -> Task.Task Node.Error.Error Node.FileSystem.Stats" 88 | }, 89 | { 90 | "name": "symbolicLink", 91 | "comment": " Make a symbolic link.\n", 92 | "type": "String -> String -> Task.Task Node.Error.Error ()" 93 | }, 94 | { 95 | "name": "writeFile", 96 | "comment": " Write a file from a Buffer.\n\nNon-existent directories in the filename path will be created.\n\n", 97 | "type": "String -> Node.FileSystem.Mode -> Node.Buffer.Buffer -> Task.Task Node.Error.Error ()" 98 | }, 99 | { 100 | "name": "writeFileFromString", 101 | "comment": " Write a file from a String.\n\nNon-existent directories in the file's path will be created.\n\n", 102 | "type": "String -> Node.FileSystem.Mode -> Node.Encoding.Encoding -> String -> Task.Task Node.Error.Error ()" 103 | } 104 | ], 105 | "generated-with-elm-version": "0.18.0" 106 | }, 107 | { 108 | "name": "Node.Crypto", 109 | "comment": " Native bindings for Node's Crypto module.\n\n@docs Cipher , decrypt , encrypt , randomBytes\n\n", 110 | "aliases": [], 111 | "types": [ 112 | { 113 | "name": "Cipher", 114 | "comment": " Cipher types supported by [Openssl](https://www.openssl.org/docs/man1.0.2/apps/enc.html).\n", 115 | "args": [], 116 | "cases": [ 117 | [ 118 | "Aes128", 119 | [] 120 | ], 121 | [ 122 | "Aes128CipherBlockChaining", 123 | [] 124 | ], 125 | [ 126 | "Aes128CipherFeedback", 127 | [] 128 | ], 129 | [ 130 | "Aes128CipherFeedback1", 131 | [] 132 | ], 133 | [ 134 | "Aes128CipherFeedback8", 135 | [] 136 | ], 137 | [ 138 | "Aes128ElectronicCookbook", 139 | [] 140 | ], 141 | [ 142 | "Aes128OutputFeedback", 143 | [] 144 | ], 145 | [ 146 | "Aes192", 147 | [] 148 | ], 149 | [ 150 | "Aes192CipherBlockChaining", 151 | [] 152 | ], 153 | [ 154 | "Aes192CipherFeedback", 155 | [] 156 | ], 157 | [ 158 | "Aes192CipherFeedback1", 159 | [] 160 | ], 161 | [ 162 | "Aes192CipherFeedback8", 163 | [] 164 | ], 165 | [ 166 | "Aes192ElectronicCookbook", 167 | [] 168 | ], 169 | [ 170 | "Aes192OutputFeedback", 171 | [] 172 | ], 173 | [ 174 | "Aes256", 175 | [] 176 | ], 177 | [ 178 | "Aes256CipherBlockChaining", 179 | [] 180 | ], 181 | [ 182 | "Aes256CipherFeedback", 183 | [] 184 | ], 185 | [ 186 | "Aes256CipherFeedback1", 187 | [] 188 | ], 189 | [ 190 | "Aes256CipherFeedback8", 191 | [] 192 | ], 193 | [ 194 | "Aes256ElectronicCookbook", 195 | [] 196 | ], 197 | [ 198 | "Aes256OutputFeedback", 199 | [] 200 | ], 201 | [ 202 | "Base64", 203 | [] 204 | ], 205 | [ 206 | "Bf", 207 | [] 208 | ], 209 | [ 210 | "BfCipherBlockChaining", 211 | [] 212 | ], 213 | [ 214 | "BfCipherFeedback", 215 | [] 216 | ], 217 | [ 218 | "BfElectronicCookbook", 219 | [] 220 | ], 221 | [ 222 | "BfOutputFeedback", 223 | [] 224 | ], 225 | [ 226 | "Cast", 227 | [] 228 | ], 229 | [ 230 | "CastCipherBlockChaining", 231 | [] 232 | ], 233 | [ 234 | "Cast5CipherBlockChaining", 235 | [] 236 | ], 237 | [ 238 | "Cast5CipherFeedback", 239 | [] 240 | ], 241 | [ 242 | "Cast5ElectronicCookbook", 243 | [] 244 | ], 245 | [ 246 | "Cast5OutputFeedback", 247 | [] 248 | ], 249 | [ 250 | "Des", 251 | [] 252 | ], 253 | [ 254 | "DesCipherBlockChaining", 255 | [] 256 | ], 257 | [ 258 | "DesCipherFeedback", 259 | [] 260 | ], 261 | [ 262 | "DesElectronicCookbook", 263 | [] 264 | ], 265 | [ 266 | "DesOutputFeedback", 267 | [] 268 | ], 269 | [ 270 | "DesEde", 271 | [] 272 | ], 273 | [ 274 | "DesEdeCipherBlockChaining", 275 | [] 276 | ], 277 | [ 278 | "DesEdeCipherFeedback", 279 | [] 280 | ], 281 | [ 282 | "DesEdeOutputFeedback", 283 | [] 284 | ], 285 | [ 286 | "Des3", 287 | [] 288 | ], 289 | [ 290 | "DesEde3", 291 | [] 292 | ], 293 | [ 294 | "DesEde3CipherBlockChaining", 295 | [] 296 | ], 297 | [ 298 | "DesEde3CipherFeedback", 299 | [] 300 | ], 301 | [ 302 | "DesEde3OutputFeedback", 303 | [] 304 | ], 305 | [ 306 | "Desx", 307 | [] 308 | ], 309 | [ 310 | "Gost89", 311 | [] 312 | ], 313 | [ 314 | "Gost89CNT", 315 | [] 316 | ], 317 | [ 318 | "Idea", 319 | [] 320 | ], 321 | [ 322 | "IdeaCipherBlockChaining", 323 | [] 324 | ], 325 | [ 326 | "IdeaCipherFeedback", 327 | [] 328 | ], 329 | [ 330 | "IdeaElectronicCookbook", 331 | [] 332 | ], 333 | [ 334 | "IdeaOutputFeedback", 335 | [] 336 | ], 337 | [ 338 | "Rc2", 339 | [] 340 | ], 341 | [ 342 | "Rc2CipherBlockChaining", 343 | [] 344 | ], 345 | [ 346 | "Rc2CipherFeedback", 347 | [] 348 | ], 349 | [ 350 | "Rc2ElectronicCookbook", 351 | [] 352 | ], 353 | [ 354 | "Rc2OutputFeedback", 355 | [] 356 | ], 357 | [ 358 | "Rc240CipherBlockChaining", 359 | [] 360 | ], 361 | [ 362 | "Rc264CipherBlockChaining", 363 | [] 364 | ], 365 | [ 366 | "Rc4", 367 | [] 368 | ], 369 | [ 370 | "Rc440", 371 | [] 372 | ], 373 | [ 374 | "Rc464", 375 | [] 376 | ], 377 | [ 378 | "Rc5", 379 | [] 380 | ], 381 | [ 382 | "Rc5CipherBlockChaining", 383 | [] 384 | ], 385 | [ 386 | "Rc5CipherFeedback", 387 | [] 388 | ], 389 | [ 390 | "Rc5ElectronicCookbook", 391 | [] 392 | ], 393 | [ 394 | "Rc5OutputFeedback", 395 | [] 396 | ], 397 | [ 398 | "None", 399 | [] 400 | ] 401 | ] 402 | } 403 | ], 404 | "values": [ 405 | { 406 | "name": "decrypt", 407 | "comment": " Decrypt a Buffer.\n", 408 | "type": "Node.Crypto.Cipher -> String -> Node.Buffer.Buffer -> Result.Result Node.Error.Error Node.Buffer.Buffer" 409 | }, 410 | { 411 | "name": "encrypt", 412 | "comment": " Encrypt a Buffer.\n", 413 | "type": "Node.Crypto.Cipher -> String -> Node.Buffer.Buffer -> Result.Result Node.Error.Error Node.Buffer.Buffer" 414 | }, 415 | { 416 | "name": "randomBytes", 417 | "comment": " Generate cryptographically strong pseudo-random data.\n", 418 | "type": "Int -> Task.Task Node.Error.Error Node.Buffer.Buffer" 419 | } 420 | ], 421 | "generated-with-elm-version": "0.18.0" 422 | }, 423 | { 424 | "name": "Node.Process", 425 | "comment": " Process\n\n@docs cwd , environment\n\n", 426 | "aliases": [], 427 | "types": [], 428 | "values": [ 429 | { 430 | "name": "cwd", 431 | "comment": " Current working directory.\n", 432 | "type": "() -> Task.Task Node.Error.Error String" 433 | }, 434 | { 435 | "name": "environment", 436 | "comment": " Environment variables.\n", 437 | "type": "Result.Result String (Dict.Dict String String)" 438 | } 439 | ], 440 | "generated-with-elm-version": "0.18.0" 441 | }, 442 | { 443 | "name": "Node.Global", 444 | "comment": " Global functions\n\n@docs intToString , stringToInt\n\n", 445 | "aliases": [], 446 | "types": [], 447 | "values": [ 448 | { 449 | "name": "intToString", 450 | "comment": " Convert an integer into a string using the specified radix.\n", 451 | "type": "Int -> Int -> Result.Result Node.Error.Error String" 452 | }, 453 | { 454 | "name": "stringToInt", 455 | "comment": " Convert a string into an integer using the specified radix.\n", 456 | "type": "Int -> String -> Result.Result Node.Error.Error Int" 457 | } 458 | ], 459 | "generated-with-elm-version": "0.18.0" 460 | }, 461 | { 462 | "name": "Node.OperatingSystem", 463 | "comment": " Operating system information.\n\n@docs Platform , homeDirectory , platform , tempDirectory\n\n", 464 | "aliases": [], 465 | "types": [ 466 | { 467 | "name": "Platform", 468 | "comment": " Platforms supported by Node.js.\n", 469 | "args": [], 470 | "cases": [ 471 | [ 472 | "Aix", 473 | [] 474 | ], 475 | [ 476 | "Android", 477 | [] 478 | ], 479 | [ 480 | "Darwin", 481 | [] 482 | ], 483 | [ 484 | "FreeBsd", 485 | [] 486 | ], 487 | [ 488 | "Linux", 489 | [] 490 | ], 491 | [ 492 | "OpenBsd", 493 | [] 494 | ], 495 | [ 496 | "SunOs", 497 | [] 498 | ], 499 | [ 500 | "Windows", 501 | [] 502 | ] 503 | ] 504 | } 505 | ], 506 | "values": [ 507 | { 508 | "name": "homeDirectory", 509 | "comment": " Current user's home directory.\n", 510 | "type": "String" 511 | }, 512 | { 513 | "name": "platform", 514 | "comment": " Platform set at compile time of current running version of Node.js.\n", 515 | "type": "Result.Result Node.Error.Error Node.OperatingSystem.Platform" 516 | }, 517 | { 518 | "name": "tempDirectory", 519 | "comment": " Current user's temporary directory.\n", 520 | "type": "String" 521 | } 522 | ], 523 | "generated-with-elm-version": "0.18.0" 524 | }, 525 | { 526 | "name": "Node.Buffer", 527 | "comment": " Native bindings for Buffer module.\n\n@docs Buffer , fromString , toString\n\n", 528 | "aliases": [ 529 | { 530 | "name": "Buffer", 531 | "comment": " Buffer type.\n", 532 | "args": [], 533 | "type": "Node.Buffer.LowLevel.Buffer" 534 | } 535 | ], 536 | "types": [], 537 | "values": [ 538 | { 539 | "name": "fromString", 540 | "comment": " Convert a String to a Buffer.\n", 541 | "type": "Node.Encoding.Encoding -> String -> Result.Result Node.Error.Error Node.Buffer.Buffer" 542 | }, 543 | { 544 | "name": "toString", 545 | "comment": " Convert a Buffer to a String.\n", 546 | "type": "Node.Encoding.Encoding -> Node.Buffer.Buffer -> Result.Result Node.Error.Error String" 547 | } 548 | ], 549 | "generated-with-elm-version": "0.18.0" 550 | }, 551 | { 552 | "name": "Node.ChildProcess", 553 | "comment": " Child Process\n\n@docs Output , Exit , spawn\n\n", 554 | "aliases": [], 555 | "types": [ 556 | { 557 | "name": "Exit", 558 | "comment": " Exit type.\n", 559 | "args": [], 560 | "cases": [ 561 | [ 562 | "Code", 563 | [ 564 | "Int" 565 | ] 566 | ], 567 | [ 568 | "Signal", 569 | [ 570 | "String" 571 | ] 572 | ] 573 | ] 574 | }, 575 | { 576 | "name": "Output", 577 | "comment": " Output type.\n", 578 | "args": [], 579 | "cases": [ 580 | [ 581 | "Silent", 582 | [] 583 | ], 584 | [ 585 | "Verbose", 586 | [] 587 | ] 588 | ] 589 | } 590 | ], 591 | "values": [ 592 | { 593 | "name": "spawn", 594 | "comment": " Spawn a child process by running the given command.\n", 595 | "type": "String -> Node.ChildProcess.Output -> Task.Task Node.Error.Error Node.ChildProcess.Exit" 596 | } 597 | ], 598 | "generated-with-elm-version": "0.18.0" 599 | }, 600 | { 601 | "name": "Node.Path", 602 | "comment": " Path\n\n@docs basename , delimiter , dirname , extname , join , separator\n\n", 603 | "aliases": [], 604 | "types": [], 605 | "values": [ 606 | { 607 | "name": "basename", 608 | "comment": " Extract the basename from a filename.\n", 609 | "type": "String -> String" 610 | }, 611 | { 612 | "name": "delimiter", 613 | "comment": " The platform-specific path delimiter.\n", 614 | "type": "String" 615 | }, 616 | { 617 | "name": "dirname", 618 | "comment": " Extract the directory name from a filename.\n", 619 | "type": "String -> String" 620 | }, 621 | { 622 | "name": "extname", 623 | "comment": " Extract the extension name from a filename.\n", 624 | "type": "String -> String" 625 | }, 626 | { 627 | "name": "join", 628 | "comment": " Build a path from the list of supplied strings\n", 629 | "type": "List String -> String" 630 | }, 631 | { 632 | "name": "separator", 633 | "comment": " The platform-specific path segment separator.\n", 634 | "type": "String" 635 | } 636 | ], 637 | "generated-with-elm-version": "0.18.0" 638 | }, 639 | { 640 | "name": "Node.Encoding", 641 | "comment": " String encodings supported by Node.js.\n\n@docs Encoding , toString\n\n", 642 | "aliases": [], 643 | "types": [ 644 | { 645 | "name": "Encoding", 646 | "comment": " Encoding union type.\n", 647 | "args": [], 648 | "cases": [ 649 | [ 650 | "Ascii", 651 | [] 652 | ], 653 | [ 654 | "Utf8", 655 | [] 656 | ], 657 | [ 658 | "Utf16le", 659 | [] 660 | ], 661 | [ 662 | "Base64", 663 | [] 664 | ], 665 | [ 666 | "Latin1", 667 | [] 668 | ], 669 | [ 670 | "Hex", 671 | [] 672 | ] 673 | ] 674 | } 675 | ], 676 | "values": [ 677 | { 678 | "name": "toString", 679 | "comment": " Convert encoding to string.\n", 680 | "type": "Node.Encoding.Encoding -> String" 681 | } 682 | ], 683 | "generated-with-elm-version": "0.18.0" 684 | }, 685 | { 686 | "name": "Node.Error", 687 | "comment": " Error type.\n\n@docs Error , message , decoder , fromValue , Code\n\n", 688 | "aliases": [], 689 | "types": [ 690 | { 691 | "name": "Code", 692 | "comment": " Error code union type.\n", 693 | "args": [], 694 | "cases": [ 695 | [ 696 | "ArgumentListTooLong", 697 | [] 698 | ], 699 | [ 700 | "PermissionDenied", 701 | [] 702 | ], 703 | [ 704 | "AddressInUse", 705 | [] 706 | ], 707 | [ 708 | "AddressNotAvailable", 709 | [] 710 | ], 711 | [ 712 | "AddressFamilyNotSupported", 713 | [] 714 | ], 715 | [ 716 | "ResourceTemporarilyUnavailable", 717 | [] 718 | ], 719 | [ 720 | "ConnectionAlreadyInProgress", 721 | [] 722 | ], 723 | [ 724 | "InvalidExchange", 725 | [] 726 | ], 727 | [ 728 | "BadFileDescriptor", 729 | [] 730 | ], 731 | [ 732 | "FileDescriptorInBadState", 733 | [] 734 | ], 735 | [ 736 | "BadMessage", 737 | [] 738 | ], 739 | [ 740 | "InvalidRequestDescriptor", 741 | [] 742 | ], 743 | [ 744 | "InvalidRequestCode", 745 | [] 746 | ], 747 | [ 748 | "InvalidSlot", 749 | [] 750 | ], 751 | [ 752 | "DeviceOrResourceBusy", 753 | [] 754 | ], 755 | [ 756 | "OperationCancelled", 757 | [] 758 | ], 759 | [ 760 | "NoChildProcesses", 761 | [] 762 | ], 763 | [ 764 | "ChannelNumberOutOfRange", 765 | [] 766 | ], 767 | [ 768 | "CommunicationErrorOnSend", 769 | [] 770 | ], 771 | [ 772 | "ConnectionAborted", 773 | [] 774 | ], 775 | [ 776 | "ConnectionRefused", 777 | [] 778 | ], 779 | [ 780 | "ConnectionReset", 781 | [] 782 | ], 783 | [ 784 | "ResourceDeadlockAvoided", 785 | [] 786 | ], 787 | [ 788 | "DestinationAddressRequired", 789 | [] 790 | ], 791 | [ 792 | "ArgumentOutOfDomain", 793 | [] 794 | ], 795 | [ 796 | "DiskQuotaExceeded", 797 | [] 798 | ], 799 | [ 800 | "FileExists", 801 | [] 802 | ], 803 | [ 804 | "BadAddress", 805 | [] 806 | ], 807 | [ 808 | "FileTooLarge", 809 | [] 810 | ], 811 | [ 812 | "HostDown", 813 | [] 814 | ], 815 | [ 816 | "HostUnreachable", 817 | [] 818 | ], 819 | [ 820 | "IdentifierRemoved", 821 | [] 822 | ], 823 | [ 824 | "IllegalByteSequence", 825 | [] 826 | ], 827 | [ 828 | "OperationInProgress", 829 | [] 830 | ], 831 | [ 832 | "InteruptedFunctionCall", 833 | [] 834 | ], 835 | [ 836 | "InvalidArgument", 837 | [] 838 | ], 839 | [ 840 | "InputOutput", 841 | [] 842 | ], 843 | [ 844 | "SocketConnected", 845 | [] 846 | ], 847 | [ 848 | "IsADirectory", 849 | [] 850 | ], 851 | [ 852 | "NamedTypeFile", 853 | [] 854 | ], 855 | [ 856 | "KeyExpired", 857 | [] 858 | ], 859 | [ 860 | "KeyRejected", 861 | [] 862 | ], 863 | [ 864 | "KeyRevoked", 865 | [] 866 | ], 867 | [ 868 | "Level2Halted", 869 | [] 870 | ], 871 | [ 872 | "Level2NotSynchronized", 873 | [] 874 | ], 875 | [ 876 | "Level3Halted", 877 | [] 878 | ], 879 | [ 880 | "CannotAccessLibrary", 881 | [] 882 | ], 883 | [ 884 | "LibraryCorrupted", 885 | [] 886 | ], 887 | [ 888 | "TooManyLibraries", 889 | [] 890 | ], 891 | [ 892 | "LibSectionCorrupted", 893 | [] 894 | ], 895 | [ 896 | "CannotExecuteLibrary", 897 | [] 898 | ], 899 | [ 900 | "TooManyLevelsOfSymbolicLinks", 901 | [] 902 | ], 903 | [ 904 | "WrongMediumType", 905 | [] 906 | ], 907 | [ 908 | "TooManyOpenFiles", 909 | [] 910 | ], 911 | [ 912 | "TooManyLinks", 913 | [] 914 | ], 915 | [ 916 | "MessageTooLong", 917 | [] 918 | ], 919 | [ 920 | "MultihopAttempted", 921 | [] 922 | ], 923 | [ 924 | "FilenameTooLong", 925 | [] 926 | ], 927 | [ 928 | "NetworkDown", 929 | [] 930 | ], 931 | [ 932 | "ConnectionAbortedByNetwork", 933 | [] 934 | ], 935 | [ 936 | "NetworkUnreachable", 937 | [] 938 | ], 939 | [ 940 | "NoBufferSpaceAvailable", 941 | [] 942 | ], 943 | [ 944 | "NoDataAvailable", 945 | [] 946 | ], 947 | [ 948 | "NoDevice", 949 | [] 950 | ], 951 | [ 952 | "NoSuchFileOrDirectory", 953 | [] 954 | ], 955 | [ 956 | "ExecuteFormatError", 957 | [] 958 | ], 959 | [ 960 | "RequiredKeyNotAvailable", 961 | [] 962 | ], 963 | [ 964 | "NoLocksAvailable", 965 | [] 966 | ], 967 | [ 968 | "NoLink", 969 | [] 970 | ], 971 | [ 972 | "NoMedium", 973 | [] 974 | ], 975 | [ 976 | "NotEnoughSpace", 977 | [] 978 | ], 979 | [ 980 | "NoMessage", 981 | [] 982 | ], 983 | [ 984 | "NotOnNetwork", 985 | [] 986 | ], 987 | [ 988 | "PackageNotInstalled", 989 | [] 990 | ], 991 | [ 992 | "ProtocolNotAvailable", 993 | [] 994 | ], 995 | [ 996 | "NoStreamResources", 997 | [] 998 | ], 999 | [ 1000 | "NotStream", 1001 | [] 1002 | ], 1003 | [ 1004 | "FunctionNotImplemented", 1005 | [] 1006 | ], 1007 | [ 1008 | "BlockDeviceRequired", 1009 | [] 1010 | ], 1011 | [ 1012 | "SocketNotConnected", 1013 | [] 1014 | ], 1015 | [ 1016 | "NotADirectory", 1017 | [] 1018 | ], 1019 | [ 1020 | "DirectoryNotEmpty", 1021 | [] 1022 | ], 1023 | [ 1024 | "NotSocket", 1025 | [] 1026 | ], 1027 | [ 1028 | "OperationNotSupported", 1029 | [] 1030 | ], 1031 | [ 1032 | "InappropriateIOControlOperation", 1033 | [] 1034 | ], 1035 | [ 1036 | "NameNotUniqueOnNetwork", 1037 | [] 1038 | ], 1039 | [ 1040 | "NoDeviceOrAddress", 1041 | [] 1042 | ], 1043 | [ 1044 | "OperationNotSupportedOnSocket", 1045 | [] 1046 | ], 1047 | [ 1048 | "ValueTooLarge", 1049 | [] 1050 | ], 1051 | [ 1052 | "OperationNotPermitted", 1053 | [] 1054 | ], 1055 | [ 1056 | "ProtocolFamilyNotAvailable", 1057 | [] 1058 | ], 1059 | [ 1060 | "BrokenPipe", 1061 | [] 1062 | ], 1063 | [ 1064 | "Protocol", 1065 | [] 1066 | ], 1067 | [ 1068 | "ProtocolNotSupported", 1069 | [] 1070 | ], 1071 | [ 1072 | "WrongProtocolForSocket", 1073 | [] 1074 | ], 1075 | [ 1076 | "ResultTooLarge", 1077 | [] 1078 | ], 1079 | [ 1080 | "RemoteAddressChanged", 1081 | [] 1082 | ], 1083 | [ 1084 | "ObjectRemote", 1085 | [] 1086 | ], 1087 | [ 1088 | "RemoteIO", 1089 | [] 1090 | ], 1091 | [ 1092 | "RestartCall", 1093 | [] 1094 | ], 1095 | [ 1096 | "ReadOnlyFileSystem", 1097 | [] 1098 | ], 1099 | [ 1100 | "TransportEndpointShutdown", 1101 | [] 1102 | ], 1103 | [ 1104 | "InvalidSeek", 1105 | [] 1106 | ], 1107 | [ 1108 | "SocketNotSupported", 1109 | [] 1110 | ], 1111 | [ 1112 | "NoProcess", 1113 | [] 1114 | ], 1115 | [ 1116 | "StaleFileHandle", 1117 | [] 1118 | ], 1119 | [ 1120 | "StreamPipe", 1121 | [] 1122 | ], 1123 | [ 1124 | "TimerExpired", 1125 | [] 1126 | ], 1127 | [ 1128 | "ConnectionTimedOut", 1129 | [] 1130 | ], 1131 | [ 1132 | "TextFileBusy", 1133 | [] 1134 | ], 1135 | [ 1136 | "StructureNeedsCleaning", 1137 | [] 1138 | ], 1139 | [ 1140 | "ProtocolDriverNotAttached", 1141 | [] 1142 | ], 1143 | [ 1144 | "TooManyUsers", 1145 | [] 1146 | ], 1147 | [ 1148 | "OperationWouldBlock", 1149 | [] 1150 | ], 1151 | [ 1152 | "ImproperLink", 1153 | [] 1154 | ], 1155 | [ 1156 | "ExchangeFull", 1157 | [] 1158 | ] 1159 | ] 1160 | }, 1161 | { 1162 | "name": "Error", 1163 | "comment": " Error union type.\n", 1164 | "args": [], 1165 | "cases": [ 1166 | [ 1167 | "Error", 1168 | [ 1169 | "String", 1170 | "String" 1171 | ] 1172 | ], 1173 | [ 1174 | "SystemError", 1175 | [ 1176 | "Node.Error.Code", 1177 | "{ message : String , stack : String , syscall : String , path : Maybe.Maybe String , address : Maybe.Maybe String , port_ : Maybe.Maybe String }" 1178 | ] 1179 | ] 1180 | ] 1181 | } 1182 | ], 1183 | "values": [ 1184 | { 1185 | "name": "decoder", 1186 | "comment": " Error decoder.\n", 1187 | "type": "Json.Decode.Decoder Node.Error.Error" 1188 | }, 1189 | { 1190 | "name": "fromValue", 1191 | "comment": " Decode an Error from a Value.\n", 1192 | "type": "Json.Decode.Value -> Node.Error.Error" 1193 | }, 1194 | { 1195 | "name": "message", 1196 | "comment": " Extract the message from an Error.\n", 1197 | "type": "Node.Error.Error -> String" 1198 | } 1199 | ], 1200 | "generated-with-elm-version": "0.18.0" 1201 | } 1202 | ] -------------------------------------------------------------------------------- /elm-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "3.0.1", 3 | "summary": "", 4 | "repository": "https://github.com/elm-node/core.git", 5 | "license": "Unlicense", 6 | "source-directories": [ 7 | "src", 8 | "test/Buffer", 9 | "test/ChildProcess", 10 | "test/Crypto", 11 | "test/FileSystem", 12 | "test/Global", 13 | "test/OperatingSystem", 14 | "test/Path", 15 | "test/Process" 16 | ], 17 | "exposed-modules": [ 18 | "Node.Buffer", 19 | "Node.ChildProcess", 20 | "Node.Crypto", 21 | "Node.Encoding", 22 | "Node.Error", 23 | "Node.FileSystem", 24 | "Node.Global", 25 | "Node.OperatingSystem", 26 | "Node.Path", 27 | "Node.Process" 28 | ], 29 | "native-modules": true, 30 | "dependencies": { 31 | "elm-community/json-extra": "2.1.0 <= v < 3.0.0", 32 | "elm-community/list-extra": "6.0.0 <= v < 7.0.0", 33 | "elm-community/result-extra": "2.2.0 <= v < 3.0.0", 34 | "elm-lang/core": "5.1.1 <= v < 6.0.0", 35 | "panosoft/elm-utils": "2.0.0 <= v < 3.0.0" 36 | }, 37 | "elm-version": "0.18.0 <= v < 0.19.0" 38 | } -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@elm-node/core", 3 | "version": "3.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "acorn": { 8 | "version": "5.1.2", 9 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", 10 | "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==", 11 | "dev": true 12 | }, 13 | "acorn-jsx": { 14 | "version": "3.0.1", 15 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", 16 | "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", 17 | "dev": true, 18 | "requires": { 19 | "acorn": "3.3.0" 20 | }, 21 | "dependencies": { 22 | "acorn": { 23 | "version": "3.3.0", 24 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", 25 | "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", 26 | "dev": true 27 | } 28 | } 29 | }, 30 | "ajv": { 31 | "version": "4.11.8", 32 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", 33 | "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", 34 | "dev": true, 35 | "requires": { 36 | "co": "4.6.0", 37 | "json-stable-stringify": "1.0.1" 38 | } 39 | }, 40 | "ajv-keywords": { 41 | "version": "1.5.1", 42 | "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", 43 | "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", 44 | "dev": true 45 | }, 46 | "ansi-escapes": { 47 | "version": "1.4.0", 48 | "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", 49 | "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", 50 | "dev": true 51 | }, 52 | "ansi-regex": { 53 | "version": "2.1.1", 54 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 55 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", 56 | "dev": true 57 | }, 58 | "ansi-styles": { 59 | "version": "2.2.1", 60 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", 61 | "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", 62 | "dev": true 63 | }, 64 | "argparse": { 65 | "version": "1.0.9", 66 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", 67 | "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", 68 | "dev": true, 69 | "requires": { 70 | "sprintf-js": "1.0.3" 71 | } 72 | }, 73 | "array-filter": { 74 | "version": "0.0.1", 75 | "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", 76 | "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", 77 | "dev": true 78 | }, 79 | "array-map": { 80 | "version": "0.0.0", 81 | "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", 82 | "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", 83 | "dev": true 84 | }, 85 | "array-reduce": { 86 | "version": "0.0.0", 87 | "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", 88 | "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", 89 | "dev": true 90 | }, 91 | "array-union": { 92 | "version": "1.0.2", 93 | "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", 94 | "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", 95 | "dev": true, 96 | "requires": { 97 | "array-uniq": "1.0.3" 98 | } 99 | }, 100 | "array-uniq": { 101 | "version": "1.0.3", 102 | "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", 103 | "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", 104 | "dev": true 105 | }, 106 | "arrify": { 107 | "version": "1.0.1", 108 | "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", 109 | "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", 110 | "dev": true 111 | }, 112 | "babel-code-frame": { 113 | "version": "6.26.0", 114 | "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", 115 | "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", 116 | "dev": true, 117 | "requires": { 118 | "chalk": "1.1.3", 119 | "esutils": "2.0.2", 120 | "js-tokens": "3.0.2" 121 | } 122 | }, 123 | "balanced-match": { 124 | "version": "1.0.0", 125 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 126 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 127 | }, 128 | "brace-expansion": { 129 | "version": "1.1.8", 130 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", 131 | "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", 132 | "requires": { 133 | "balanced-match": "1.0.0", 134 | "concat-map": "0.0.1" 135 | } 136 | }, 137 | "builtin-modules": { 138 | "version": "1.1.1", 139 | "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", 140 | "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", 141 | "dev": true 142 | }, 143 | "caller-path": { 144 | "version": "0.1.0", 145 | "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", 146 | "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", 147 | "dev": true, 148 | "requires": { 149 | "callsites": "0.2.0" 150 | } 151 | }, 152 | "callsites": { 153 | "version": "0.2.0", 154 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", 155 | "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", 156 | "dev": true 157 | }, 158 | "chalk": { 159 | "version": "1.1.3", 160 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", 161 | "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", 162 | "dev": true, 163 | "requires": { 164 | "ansi-styles": "2.2.1", 165 | "escape-string-regexp": "1.0.5", 166 | "has-ansi": "2.0.0", 167 | "strip-ansi": "3.0.1", 168 | "supports-color": "2.0.0" 169 | } 170 | }, 171 | "circular-json": { 172 | "version": "0.3.3", 173 | "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", 174 | "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", 175 | "dev": true 176 | }, 177 | "cli-cursor": { 178 | "version": "1.0.2", 179 | "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", 180 | "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", 181 | "dev": true, 182 | "requires": { 183 | "restore-cursor": "1.0.1" 184 | } 185 | }, 186 | "cli-width": { 187 | "version": "2.2.0", 188 | "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", 189 | "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", 190 | "dev": true 191 | }, 192 | "co": { 193 | "version": "4.6.0", 194 | "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", 195 | "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", 196 | "dev": true 197 | }, 198 | "code-point-at": { 199 | "version": "1.1.0", 200 | "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", 201 | "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", 202 | "dev": true 203 | }, 204 | "color-convert": { 205 | "version": "1.9.0", 206 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", 207 | "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", 208 | "dev": true, 209 | "requires": { 210 | "color-name": "1.1.3" 211 | } 212 | }, 213 | "color-name": { 214 | "version": "1.1.3", 215 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 216 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 217 | "dev": true 218 | }, 219 | "concat-map": { 220 | "version": "0.0.1", 221 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 222 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 223 | }, 224 | "concat-stream": { 225 | "version": "1.6.0", 226 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", 227 | "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", 228 | "dev": true, 229 | "requires": { 230 | "inherits": "2.0.3", 231 | "readable-stream": "2.3.3", 232 | "typedarray": "0.0.6" 233 | }, 234 | "dependencies": { 235 | "readable-stream": { 236 | "version": "2.3.3", 237 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", 238 | "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", 239 | "dev": true, 240 | "requires": { 241 | "core-util-is": "1.0.2", 242 | "inherits": "2.0.3", 243 | "isarray": "1.0.0", 244 | "process-nextick-args": "1.0.7", 245 | "safe-buffer": "5.1.1", 246 | "string_decoder": "1.0.3", 247 | "util-deprecate": "1.0.2" 248 | } 249 | }, 250 | "string_decoder": { 251 | "version": "1.0.3", 252 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", 253 | "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", 254 | "dev": true, 255 | "requires": { 256 | "safe-buffer": "5.1.1" 257 | } 258 | } 259 | } 260 | }, 261 | "core-util-is": { 262 | "version": "1.0.2", 263 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 264 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 265 | "dev": true 266 | }, 267 | "cpr": { 268 | "version": "2.2.0", 269 | "resolved": "https://registry.npmjs.org/cpr/-/cpr-2.2.0.tgz", 270 | "integrity": "sha512-q8UoWzIT9rslJKb3Y5CcByzR2zX7GBkVcoU6jJx02d/BgbE7zJ8Aix74i7bw3iYk58TrgXhmB2XB0aGaBd7oZA==", 271 | "requires": { 272 | "graceful-fs": "4.1.11", 273 | "minimist": "1.2.0", 274 | "mkdirp": "0.5.1", 275 | "rimraf": "2.6.2" 276 | }, 277 | "dependencies": { 278 | "minimist": { 279 | "version": "1.2.0", 280 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 281 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" 282 | } 283 | } 284 | }, 285 | "cross-spawn": { 286 | "version": "5.1.0", 287 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", 288 | "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", 289 | "dev": true, 290 | "requires": { 291 | "lru-cache": "4.1.1", 292 | "shebang-command": "1.2.0", 293 | "which": "1.3.0" 294 | } 295 | }, 296 | "d": { 297 | "version": "1.0.0", 298 | "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", 299 | "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", 300 | "dev": true, 301 | "requires": { 302 | "es5-ext": "0.10.31" 303 | } 304 | }, 305 | "debug": { 306 | "version": "2.6.9", 307 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 308 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 309 | "dev": true, 310 | "requires": { 311 | "ms": "2.0.0" 312 | } 313 | }, 314 | "deep-is": { 315 | "version": "0.1.3", 316 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", 317 | "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", 318 | "dev": true 319 | }, 320 | "define-properties": { 321 | "version": "1.1.2", 322 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", 323 | "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", 324 | "dev": true, 325 | "requires": { 326 | "foreach": "2.0.5", 327 | "object-keys": "1.0.11" 328 | } 329 | }, 330 | "del": { 331 | "version": "2.2.2", 332 | "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", 333 | "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", 334 | "dev": true, 335 | "requires": { 336 | "globby": "5.0.0", 337 | "is-path-cwd": "1.0.0", 338 | "is-path-in-cwd": "1.0.0", 339 | "object-assign": "4.1.1", 340 | "pify": "2.3.0", 341 | "pinkie-promise": "2.0.1", 342 | "rimraf": "2.6.2" 343 | } 344 | }, 345 | "doctrine": { 346 | "version": "2.0.0", 347 | "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", 348 | "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", 349 | "dev": true, 350 | "requires": { 351 | "esutils": "2.0.2", 352 | "isarray": "1.0.0" 353 | } 354 | }, 355 | "duplexer": { 356 | "version": "0.1.1", 357 | "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", 358 | "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", 359 | "dev": true 360 | }, 361 | "error-ex": { 362 | "version": "1.3.1", 363 | "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", 364 | "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", 365 | "dev": true, 366 | "requires": { 367 | "is-arrayish": "0.2.1" 368 | } 369 | }, 370 | "es-abstract": { 371 | "version": "1.9.0", 372 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.9.0.tgz", 373 | "integrity": "sha512-kk3IJoKo7A3pWJc0OV8yZ/VEX2oSUytfekrJiqoxBlKJMFAJVJVpGdHClCCTdv+Fn2zHfpDHHIelMFhZVfef3Q==", 374 | "dev": true, 375 | "requires": { 376 | "es-to-primitive": "1.1.1", 377 | "function-bind": "1.1.1", 378 | "has": "1.0.1", 379 | "is-callable": "1.1.3", 380 | "is-regex": "1.0.4" 381 | } 382 | }, 383 | "es-to-primitive": { 384 | "version": "1.1.1", 385 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", 386 | "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", 387 | "dev": true, 388 | "requires": { 389 | "is-callable": "1.1.3", 390 | "is-date-object": "1.0.1", 391 | "is-symbol": "1.0.1" 392 | } 393 | }, 394 | "es5-ext": { 395 | "version": "0.10.31", 396 | "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.31.tgz", 397 | "integrity": "sha1-e7k4yVp/G59ygJLcCcQe3MOY7v4=", 398 | "dev": true, 399 | "requires": { 400 | "es6-iterator": "2.0.1", 401 | "es6-symbol": "3.1.1" 402 | } 403 | }, 404 | "es6-iterator": { 405 | "version": "2.0.1", 406 | "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", 407 | "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", 408 | "dev": true, 409 | "requires": { 410 | "d": "1.0.0", 411 | "es5-ext": "0.10.31", 412 | "es6-symbol": "3.1.1" 413 | } 414 | }, 415 | "es6-map": { 416 | "version": "0.1.5", 417 | "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", 418 | "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", 419 | "dev": true, 420 | "requires": { 421 | "d": "1.0.0", 422 | "es5-ext": "0.10.31", 423 | "es6-iterator": "2.0.1", 424 | "es6-set": "0.1.5", 425 | "es6-symbol": "3.1.1", 426 | "event-emitter": "0.3.5" 427 | } 428 | }, 429 | "es6-set": { 430 | "version": "0.1.5", 431 | "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", 432 | "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", 433 | "dev": true, 434 | "requires": { 435 | "d": "1.0.0", 436 | "es5-ext": "0.10.31", 437 | "es6-iterator": "2.0.1", 438 | "es6-symbol": "3.1.1", 439 | "event-emitter": "0.3.5" 440 | } 441 | }, 442 | "es6-symbol": { 443 | "version": "3.1.1", 444 | "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", 445 | "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", 446 | "dev": true, 447 | "requires": { 448 | "d": "1.0.0", 449 | "es5-ext": "0.10.31" 450 | } 451 | }, 452 | "es6-weak-map": { 453 | "version": "2.0.2", 454 | "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", 455 | "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", 456 | "dev": true, 457 | "requires": { 458 | "d": "1.0.0", 459 | "es5-ext": "0.10.31", 460 | "es6-iterator": "2.0.1", 461 | "es6-symbol": "3.1.1" 462 | } 463 | }, 464 | "escape-string-regexp": { 465 | "version": "1.0.5", 466 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 467 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 468 | "dev": true 469 | }, 470 | "escope": { 471 | "version": "3.6.0", 472 | "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", 473 | "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", 474 | "dev": true, 475 | "requires": { 476 | "es6-map": "0.1.5", 477 | "es6-weak-map": "2.0.2", 478 | "esrecurse": "4.2.0", 479 | "estraverse": "4.2.0" 480 | } 481 | }, 482 | "eslint": { 483 | "version": "3.19.0", 484 | "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", 485 | "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", 486 | "dev": true, 487 | "requires": { 488 | "babel-code-frame": "6.26.0", 489 | "chalk": "1.1.3", 490 | "concat-stream": "1.6.0", 491 | "debug": "2.6.9", 492 | "doctrine": "2.0.0", 493 | "escope": "3.6.0", 494 | "espree": "3.5.1", 495 | "esquery": "1.0.0", 496 | "estraverse": "4.2.0", 497 | "esutils": "2.0.2", 498 | "file-entry-cache": "2.0.0", 499 | "glob": "7.1.2", 500 | "globals": "9.18.0", 501 | "ignore": "3.3.5", 502 | "imurmurhash": "0.1.4", 503 | "inquirer": "0.12.0", 504 | "is-my-json-valid": "2.16.1", 505 | "is-resolvable": "1.0.0", 506 | "js-yaml": "3.10.0", 507 | "json-stable-stringify": "1.0.1", 508 | "levn": "0.3.0", 509 | "lodash": "4.17.4", 510 | "mkdirp": "0.5.1", 511 | "natural-compare": "1.4.0", 512 | "optionator": "0.8.2", 513 | "path-is-inside": "1.0.2", 514 | "pluralize": "1.2.1", 515 | "progress": "1.1.8", 516 | "require-uncached": "1.0.3", 517 | "shelljs": "0.7.5", 518 | "strip-bom": "3.0.0", 519 | "strip-json-comments": "2.0.1", 520 | "table": "3.8.3", 521 | "text-table": "0.2.0", 522 | "user-home": "2.0.0" 523 | } 524 | }, 525 | "eslint-config-elm": { 526 | "version": "2.0.0", 527 | "resolved": "https://registry.npmjs.org/eslint-config-elm/-/eslint-config-elm-2.0.0.tgz", 528 | "integrity": "sha1-PxUz+W+VA2uClxysu054o44oya0=", 529 | "dev": true 530 | }, 531 | "espree": { 532 | "version": "3.5.1", 533 | "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", 534 | "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", 535 | "dev": true, 536 | "requires": { 537 | "acorn": "5.1.2", 538 | "acorn-jsx": "3.0.1" 539 | } 540 | }, 541 | "esprima": { 542 | "version": "4.0.0", 543 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", 544 | "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", 545 | "dev": true 546 | }, 547 | "esquery": { 548 | "version": "1.0.0", 549 | "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", 550 | "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", 551 | "dev": true, 552 | "requires": { 553 | "estraverse": "4.2.0" 554 | } 555 | }, 556 | "esrecurse": { 557 | "version": "4.2.0", 558 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", 559 | "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", 560 | "dev": true, 561 | "requires": { 562 | "estraverse": "4.2.0", 563 | "object-assign": "4.1.1" 564 | } 565 | }, 566 | "estraverse": { 567 | "version": "4.2.0", 568 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", 569 | "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", 570 | "dev": true 571 | }, 572 | "esutils": { 573 | "version": "2.0.2", 574 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", 575 | "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", 576 | "dev": true 577 | }, 578 | "event-emitter": { 579 | "version": "0.3.5", 580 | "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", 581 | "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", 582 | "dev": true, 583 | "requires": { 584 | "d": "1.0.0", 585 | "es5-ext": "0.10.31" 586 | } 587 | }, 588 | "event-stream": { 589 | "version": "3.3.4", 590 | "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", 591 | "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", 592 | "dev": true, 593 | "requires": { 594 | "duplexer": "0.1.1", 595 | "from": "0.1.7", 596 | "map-stream": "0.1.0", 597 | "pause-stream": "0.0.11", 598 | "split": "0.3.3", 599 | "stream-combiner": "0.0.4", 600 | "through": "2.3.8" 601 | } 602 | }, 603 | "exit-hook": { 604 | "version": "1.1.1", 605 | "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", 606 | "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", 607 | "dev": true 608 | }, 609 | "fast-levenshtein": { 610 | "version": "2.0.6", 611 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 612 | "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", 613 | "dev": true 614 | }, 615 | "figures": { 616 | "version": "1.7.0", 617 | "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", 618 | "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", 619 | "dev": true, 620 | "requires": { 621 | "escape-string-regexp": "1.0.5", 622 | "object-assign": "4.1.1" 623 | } 624 | }, 625 | "file-entry-cache": { 626 | "version": "2.0.0", 627 | "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", 628 | "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", 629 | "dev": true, 630 | "requires": { 631 | "flat-cache": "1.3.0", 632 | "object-assign": "4.1.1" 633 | } 634 | }, 635 | "flat-cache": { 636 | "version": "1.3.0", 637 | "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", 638 | "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", 639 | "dev": true, 640 | "requires": { 641 | "circular-json": "0.3.3", 642 | "del": "2.2.2", 643 | "graceful-fs": "4.1.11", 644 | "write": "0.2.1" 645 | } 646 | }, 647 | "foreach": { 648 | "version": "2.0.5", 649 | "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", 650 | "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", 651 | "dev": true 652 | }, 653 | "from": { 654 | "version": "0.1.7", 655 | "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", 656 | "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", 657 | "dev": true 658 | }, 659 | "fs.realpath": { 660 | "version": "1.0.0", 661 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 662 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 663 | }, 664 | "function-bind": { 665 | "version": "1.1.1", 666 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 667 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 668 | "dev": true 669 | }, 670 | "generate-function": { 671 | "version": "2.0.0", 672 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", 673 | "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", 674 | "dev": true 675 | }, 676 | "generate-object-property": { 677 | "version": "1.2.0", 678 | "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", 679 | "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", 680 | "dev": true, 681 | "requires": { 682 | "is-property": "1.0.2" 683 | } 684 | }, 685 | "glob": { 686 | "version": "7.1.2", 687 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", 688 | "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", 689 | "requires": { 690 | "fs.realpath": "1.0.0", 691 | "inflight": "1.0.6", 692 | "inherits": "2.0.3", 693 | "minimatch": "3.0.4", 694 | "once": "1.4.0", 695 | "path-is-absolute": "1.0.1" 696 | } 697 | }, 698 | "globals": { 699 | "version": "9.18.0", 700 | "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", 701 | "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", 702 | "dev": true 703 | }, 704 | "globby": { 705 | "version": "5.0.0", 706 | "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", 707 | "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", 708 | "dev": true, 709 | "requires": { 710 | "array-union": "1.0.2", 711 | "arrify": "1.0.1", 712 | "glob": "7.1.2", 713 | "object-assign": "4.1.1", 714 | "pify": "2.3.0", 715 | "pinkie-promise": "2.0.1" 716 | } 717 | }, 718 | "graceful-fs": { 719 | "version": "4.1.11", 720 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", 721 | "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" 722 | }, 723 | "has": { 724 | "version": "1.0.1", 725 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", 726 | "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", 727 | "dev": true, 728 | "requires": { 729 | "function-bind": "1.1.1" 730 | } 731 | }, 732 | "has-ansi": { 733 | "version": "2.0.0", 734 | "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", 735 | "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", 736 | "dev": true, 737 | "requires": { 738 | "ansi-regex": "2.1.1" 739 | } 740 | }, 741 | "has-flag": { 742 | "version": "2.0.0", 743 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", 744 | "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", 745 | "dev": true 746 | }, 747 | "hosted-git-info": { 748 | "version": "2.5.0", 749 | "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", 750 | "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", 751 | "dev": true 752 | }, 753 | "ignore": { 754 | "version": "3.3.5", 755 | "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", 756 | "integrity": "sha512-JLH93mL8amZQhh/p6mfQgVBH3M6epNq3DfsXsTSuSrInVjwyYlFE1nv2AgfRCC8PoOhM0jwQ5v8s9LgbK7yGDw==", 757 | "dev": true 758 | }, 759 | "imurmurhash": { 760 | "version": "0.1.4", 761 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 762 | "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 763 | "dev": true 764 | }, 765 | "inflight": { 766 | "version": "1.0.6", 767 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 768 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 769 | "requires": { 770 | "once": "1.4.0", 771 | "wrappy": "1.0.2" 772 | } 773 | }, 774 | "inherits": { 775 | "version": "2.0.3", 776 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 777 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 778 | }, 779 | "inquirer": { 780 | "version": "0.12.0", 781 | "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", 782 | "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", 783 | "dev": true, 784 | "requires": { 785 | "ansi-escapes": "1.4.0", 786 | "ansi-regex": "2.1.1", 787 | "chalk": "1.1.3", 788 | "cli-cursor": "1.0.2", 789 | "cli-width": "2.2.0", 790 | "figures": "1.7.0", 791 | "lodash": "4.17.4", 792 | "readline2": "1.0.1", 793 | "run-async": "0.1.0", 794 | "rx-lite": "3.1.2", 795 | "string-width": "1.0.2", 796 | "strip-ansi": "3.0.1", 797 | "through": "2.3.8" 798 | } 799 | }, 800 | "interpret": { 801 | "version": "1.0.4", 802 | "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", 803 | "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=", 804 | "dev": true 805 | }, 806 | "is-arrayish": { 807 | "version": "0.2.1", 808 | "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", 809 | "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", 810 | "dev": true 811 | }, 812 | "is-builtin-module": { 813 | "version": "1.0.0", 814 | "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", 815 | "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", 816 | "dev": true, 817 | "requires": { 818 | "builtin-modules": "1.1.1" 819 | } 820 | }, 821 | "is-callable": { 822 | "version": "1.1.3", 823 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", 824 | "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", 825 | "dev": true 826 | }, 827 | "is-date-object": { 828 | "version": "1.0.1", 829 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", 830 | "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", 831 | "dev": true 832 | }, 833 | "is-fullwidth-code-point": { 834 | "version": "1.0.0", 835 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", 836 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", 837 | "dev": true, 838 | "requires": { 839 | "number-is-nan": "1.0.1" 840 | } 841 | }, 842 | "is-my-json-valid": { 843 | "version": "2.16.1", 844 | "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", 845 | "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", 846 | "dev": true, 847 | "requires": { 848 | "generate-function": "2.0.0", 849 | "generate-object-property": "1.2.0", 850 | "jsonpointer": "4.0.1", 851 | "xtend": "4.0.1" 852 | } 853 | }, 854 | "is-path-cwd": { 855 | "version": "1.0.0", 856 | "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", 857 | "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", 858 | "dev": true 859 | }, 860 | "is-path-in-cwd": { 861 | "version": "1.0.0", 862 | "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", 863 | "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", 864 | "dev": true, 865 | "requires": { 866 | "is-path-inside": "1.0.0" 867 | } 868 | }, 869 | "is-path-inside": { 870 | "version": "1.0.0", 871 | "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", 872 | "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", 873 | "dev": true, 874 | "requires": { 875 | "path-is-inside": "1.0.2" 876 | } 877 | }, 878 | "is-property": { 879 | "version": "1.0.2", 880 | "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", 881 | "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", 882 | "dev": true 883 | }, 884 | "is-regex": { 885 | "version": "1.0.4", 886 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", 887 | "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", 888 | "dev": true, 889 | "requires": { 890 | "has": "1.0.1" 891 | } 892 | }, 893 | "is-resolvable": { 894 | "version": "1.0.0", 895 | "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", 896 | "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", 897 | "dev": true, 898 | "requires": { 899 | "tryit": "1.0.3" 900 | } 901 | }, 902 | "is-symbol": { 903 | "version": "1.0.1", 904 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", 905 | "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", 906 | "dev": true 907 | }, 908 | "isarray": { 909 | "version": "1.0.0", 910 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 911 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 912 | "dev": true 913 | }, 914 | "isexe": { 915 | "version": "2.0.0", 916 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 917 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 918 | "dev": true 919 | }, 920 | "js-tokens": { 921 | "version": "3.0.2", 922 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", 923 | "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", 924 | "dev": true 925 | }, 926 | "js-yaml": { 927 | "version": "3.10.0", 928 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", 929 | "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", 930 | "dev": true, 931 | "requires": { 932 | "argparse": "1.0.9", 933 | "esprima": "4.0.0" 934 | } 935 | }, 936 | "json-stable-stringify": { 937 | "version": "1.0.1", 938 | "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", 939 | "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", 940 | "dev": true, 941 | "requires": { 942 | "jsonify": "0.0.0" 943 | } 944 | }, 945 | "jsonify": { 946 | "version": "0.0.0", 947 | "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", 948 | "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", 949 | "dev": true 950 | }, 951 | "jsonpointer": { 952 | "version": "4.0.1", 953 | "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", 954 | "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", 955 | "dev": true 956 | }, 957 | "levn": { 958 | "version": "0.3.0", 959 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", 960 | "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", 961 | "dev": true, 962 | "requires": { 963 | "prelude-ls": "1.1.2", 964 | "type-check": "0.3.2" 965 | } 966 | }, 967 | "load-json-file": { 968 | "version": "2.0.0", 969 | "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", 970 | "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", 971 | "dev": true, 972 | "requires": { 973 | "graceful-fs": "4.1.11", 974 | "parse-json": "2.2.0", 975 | "pify": "2.3.0", 976 | "strip-bom": "3.0.0" 977 | } 978 | }, 979 | "lodash": { 980 | "version": "4.17.4", 981 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", 982 | "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", 983 | "dev": true 984 | }, 985 | "lru-cache": { 986 | "version": "4.1.1", 987 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", 988 | "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", 989 | "dev": true, 990 | "requires": { 991 | "pseudomap": "1.0.2", 992 | "yallist": "2.1.2" 993 | } 994 | }, 995 | "map-stream": { 996 | "version": "0.1.0", 997 | "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", 998 | "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", 999 | "dev": true 1000 | }, 1001 | "memory-streams": { 1002 | "version": "0.1.2", 1003 | "resolved": "https://registry.npmjs.org/memory-streams/-/memory-streams-0.1.2.tgz", 1004 | "integrity": "sha1-Jz/3d6tg/sWZsRY1UlUoLMosUMI=", 1005 | "dev": true, 1006 | "requires": { 1007 | "readable-stream": "1.0.34" 1008 | }, 1009 | "dependencies": { 1010 | "isarray": { 1011 | "version": "0.0.1", 1012 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", 1013 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", 1014 | "dev": true 1015 | }, 1016 | "readable-stream": { 1017 | "version": "1.0.34", 1018 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", 1019 | "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", 1020 | "dev": true, 1021 | "requires": { 1022 | "core-util-is": "1.0.2", 1023 | "inherits": "2.0.3", 1024 | "isarray": "0.0.1", 1025 | "string_decoder": "0.10.31" 1026 | } 1027 | } 1028 | } 1029 | }, 1030 | "minimatch": { 1031 | "version": "3.0.4", 1032 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 1033 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 1034 | "requires": { 1035 | "brace-expansion": "1.1.8" 1036 | } 1037 | }, 1038 | "minimist": { 1039 | "version": "0.0.8", 1040 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 1041 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" 1042 | }, 1043 | "mkdirp": { 1044 | "version": "0.5.1", 1045 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 1046 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 1047 | "requires": { 1048 | "minimist": "0.0.8" 1049 | } 1050 | }, 1051 | "ms": { 1052 | "version": "2.0.0", 1053 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1054 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", 1055 | "dev": true 1056 | }, 1057 | "mute-stream": { 1058 | "version": "0.0.5", 1059 | "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", 1060 | "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", 1061 | "dev": true 1062 | }, 1063 | "natural-compare": { 1064 | "version": "1.4.0", 1065 | "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", 1066 | "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", 1067 | "dev": true 1068 | }, 1069 | "normalize-package-data": { 1070 | "version": "2.4.0", 1071 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", 1072 | "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", 1073 | "dev": true, 1074 | "requires": { 1075 | "hosted-git-info": "2.5.0", 1076 | "is-builtin-module": "1.0.0", 1077 | "semver": "5.4.1", 1078 | "validate-npm-package-license": "3.0.1" 1079 | } 1080 | }, 1081 | "npm-run-all": { 1082 | "version": "4.1.1", 1083 | "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.1.tgz", 1084 | "integrity": "sha512-qrmqqaJa+REbzUTIL/mHfTdgwz+gL1xUezY/ueyLa7GISZ4T3h0CH8D2r6AaZdCYN2unu7PzspP0ofpXla1ftg==", 1085 | "dev": true, 1086 | "requires": { 1087 | "ansi-styles": "3.2.0", 1088 | "chalk": "2.1.0", 1089 | "cross-spawn": "5.1.0", 1090 | "memory-streams": "0.1.2", 1091 | "minimatch": "3.0.4", 1092 | "ps-tree": "1.1.0", 1093 | "read-pkg": "2.0.0", 1094 | "shell-quote": "1.6.1", 1095 | "string.prototype.padend": "3.0.0" 1096 | }, 1097 | "dependencies": { 1098 | "ansi-styles": { 1099 | "version": "3.2.0", 1100 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", 1101 | "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", 1102 | "dev": true, 1103 | "requires": { 1104 | "color-convert": "1.9.0" 1105 | } 1106 | }, 1107 | "chalk": { 1108 | "version": "2.1.0", 1109 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", 1110 | "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", 1111 | "dev": true, 1112 | "requires": { 1113 | "ansi-styles": "3.2.0", 1114 | "escape-string-regexp": "1.0.5", 1115 | "supports-color": "4.4.0" 1116 | } 1117 | }, 1118 | "supports-color": { 1119 | "version": "4.4.0", 1120 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", 1121 | "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", 1122 | "dev": true, 1123 | "requires": { 1124 | "has-flag": "2.0.0" 1125 | } 1126 | } 1127 | } 1128 | }, 1129 | "number-is-nan": { 1130 | "version": "1.0.1", 1131 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", 1132 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", 1133 | "dev": true 1134 | }, 1135 | "object-assign": { 1136 | "version": "4.1.1", 1137 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 1138 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", 1139 | "dev": true 1140 | }, 1141 | "object-keys": { 1142 | "version": "1.0.11", 1143 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", 1144 | "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", 1145 | "dev": true 1146 | }, 1147 | "once": { 1148 | "version": "1.4.0", 1149 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1150 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 1151 | "requires": { 1152 | "wrappy": "1.0.2" 1153 | } 1154 | }, 1155 | "onetime": { 1156 | "version": "1.1.0", 1157 | "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", 1158 | "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", 1159 | "dev": true 1160 | }, 1161 | "optionator": { 1162 | "version": "0.8.2", 1163 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", 1164 | "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", 1165 | "dev": true, 1166 | "requires": { 1167 | "deep-is": "0.1.3", 1168 | "fast-levenshtein": "2.0.6", 1169 | "levn": "0.3.0", 1170 | "prelude-ls": "1.1.2", 1171 | "type-check": "0.3.2", 1172 | "wordwrap": "1.0.0" 1173 | } 1174 | }, 1175 | "os-homedir": { 1176 | "version": "1.0.2", 1177 | "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", 1178 | "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", 1179 | "dev": true 1180 | }, 1181 | "parse-json": { 1182 | "version": "2.2.0", 1183 | "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", 1184 | "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", 1185 | "dev": true, 1186 | "requires": { 1187 | "error-ex": "1.3.1" 1188 | } 1189 | }, 1190 | "path-is-absolute": { 1191 | "version": "1.0.1", 1192 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1193 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 1194 | }, 1195 | "path-is-inside": { 1196 | "version": "1.0.2", 1197 | "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", 1198 | "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", 1199 | "dev": true 1200 | }, 1201 | "path-parse": { 1202 | "version": "1.0.5", 1203 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", 1204 | "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", 1205 | "dev": true 1206 | }, 1207 | "path-type": { 1208 | "version": "2.0.0", 1209 | "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", 1210 | "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", 1211 | "dev": true, 1212 | "requires": { 1213 | "pify": "2.3.0" 1214 | } 1215 | }, 1216 | "pause-stream": { 1217 | "version": "0.0.11", 1218 | "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", 1219 | "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", 1220 | "dev": true, 1221 | "requires": { 1222 | "through": "2.3.8" 1223 | } 1224 | }, 1225 | "pify": { 1226 | "version": "2.3.0", 1227 | "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", 1228 | "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", 1229 | "dev": true 1230 | }, 1231 | "pinkie": { 1232 | "version": "2.0.4", 1233 | "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", 1234 | "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", 1235 | "dev": true 1236 | }, 1237 | "pinkie-promise": { 1238 | "version": "2.0.1", 1239 | "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", 1240 | "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", 1241 | "dev": true, 1242 | "requires": { 1243 | "pinkie": "2.0.4" 1244 | } 1245 | }, 1246 | "pluralize": { 1247 | "version": "1.2.1", 1248 | "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", 1249 | "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", 1250 | "dev": true 1251 | }, 1252 | "prelude-ls": { 1253 | "version": "1.1.2", 1254 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 1255 | "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", 1256 | "dev": true 1257 | }, 1258 | "process-nextick-args": { 1259 | "version": "1.0.7", 1260 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", 1261 | "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", 1262 | "dev": true 1263 | }, 1264 | "progress": { 1265 | "version": "1.1.8", 1266 | "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", 1267 | "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", 1268 | "dev": true 1269 | }, 1270 | "ps-tree": { 1271 | "version": "1.1.0", 1272 | "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz", 1273 | "integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=", 1274 | "dev": true, 1275 | "requires": { 1276 | "event-stream": "3.3.4" 1277 | } 1278 | }, 1279 | "pseudomap": { 1280 | "version": "1.0.2", 1281 | "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", 1282 | "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", 1283 | "dev": true 1284 | }, 1285 | "read-pkg": { 1286 | "version": "2.0.0", 1287 | "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", 1288 | "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", 1289 | "dev": true, 1290 | "requires": { 1291 | "load-json-file": "2.0.0", 1292 | "normalize-package-data": "2.4.0", 1293 | "path-type": "2.0.0" 1294 | } 1295 | }, 1296 | "readline2": { 1297 | "version": "1.0.1", 1298 | "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", 1299 | "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", 1300 | "dev": true, 1301 | "requires": { 1302 | "code-point-at": "1.1.0", 1303 | "is-fullwidth-code-point": "1.0.0", 1304 | "mute-stream": "0.0.5" 1305 | } 1306 | }, 1307 | "rechoir": { 1308 | "version": "0.6.2", 1309 | "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", 1310 | "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", 1311 | "dev": true, 1312 | "requires": { 1313 | "resolve": "1.4.0" 1314 | } 1315 | }, 1316 | "require-uncached": { 1317 | "version": "1.0.3", 1318 | "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", 1319 | "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", 1320 | "dev": true, 1321 | "requires": { 1322 | "caller-path": "0.1.0", 1323 | "resolve-from": "1.0.1" 1324 | } 1325 | }, 1326 | "resolve": { 1327 | "version": "1.4.0", 1328 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", 1329 | "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", 1330 | "dev": true, 1331 | "requires": { 1332 | "path-parse": "1.0.5" 1333 | } 1334 | }, 1335 | "resolve-from": { 1336 | "version": "1.0.1", 1337 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", 1338 | "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", 1339 | "dev": true 1340 | }, 1341 | "restore-cursor": { 1342 | "version": "1.0.1", 1343 | "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", 1344 | "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", 1345 | "dev": true, 1346 | "requires": { 1347 | "exit-hook": "1.1.1", 1348 | "onetime": "1.1.0" 1349 | } 1350 | }, 1351 | "rimraf": { 1352 | "version": "2.6.2", 1353 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", 1354 | "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", 1355 | "requires": { 1356 | "glob": "7.1.2" 1357 | } 1358 | }, 1359 | "run-async": { 1360 | "version": "0.1.0", 1361 | "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", 1362 | "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", 1363 | "dev": true, 1364 | "requires": { 1365 | "once": "1.4.0" 1366 | } 1367 | }, 1368 | "rx-lite": { 1369 | "version": "3.1.2", 1370 | "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", 1371 | "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", 1372 | "dev": true 1373 | }, 1374 | "safe-buffer": { 1375 | "version": "5.1.1", 1376 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 1377 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", 1378 | "dev": true 1379 | }, 1380 | "semver": { 1381 | "version": "5.4.1", 1382 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", 1383 | "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", 1384 | "dev": true 1385 | }, 1386 | "shebang-command": { 1387 | "version": "1.2.0", 1388 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 1389 | "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 1390 | "dev": true, 1391 | "requires": { 1392 | "shebang-regex": "1.0.0" 1393 | } 1394 | }, 1395 | "shebang-regex": { 1396 | "version": "1.0.0", 1397 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 1398 | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", 1399 | "dev": true 1400 | }, 1401 | "shell-quote": { 1402 | "version": "1.6.1", 1403 | "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", 1404 | "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", 1405 | "dev": true, 1406 | "requires": { 1407 | "array-filter": "0.0.1", 1408 | "array-map": "0.0.0", 1409 | "array-reduce": "0.0.0", 1410 | "jsonify": "0.0.0" 1411 | } 1412 | }, 1413 | "shelljs": { 1414 | "version": "0.7.5", 1415 | "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.5.tgz", 1416 | "integrity": "sha1-Lu96UKIeHM832gDfdn7GnjCtBnU=", 1417 | "dev": true, 1418 | "requires": { 1419 | "glob": "7.1.2", 1420 | "interpret": "1.0.4", 1421 | "rechoir": "0.6.2" 1422 | } 1423 | }, 1424 | "slice-ansi": { 1425 | "version": "0.0.4", 1426 | "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", 1427 | "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", 1428 | "dev": true 1429 | }, 1430 | "spdx-correct": { 1431 | "version": "1.0.2", 1432 | "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", 1433 | "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", 1434 | "dev": true, 1435 | "requires": { 1436 | "spdx-license-ids": "1.2.2" 1437 | } 1438 | }, 1439 | "spdx-expression-parse": { 1440 | "version": "1.0.4", 1441 | "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", 1442 | "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", 1443 | "dev": true 1444 | }, 1445 | "spdx-license-ids": { 1446 | "version": "1.2.2", 1447 | "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", 1448 | "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", 1449 | "dev": true 1450 | }, 1451 | "split": { 1452 | "version": "0.3.3", 1453 | "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", 1454 | "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", 1455 | "dev": true, 1456 | "requires": { 1457 | "through": "2.3.8" 1458 | } 1459 | }, 1460 | "sprintf-js": { 1461 | "version": "1.0.3", 1462 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 1463 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 1464 | "dev": true 1465 | }, 1466 | "stream-combiner": { 1467 | "version": "0.0.4", 1468 | "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", 1469 | "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", 1470 | "dev": true, 1471 | "requires": { 1472 | "duplexer": "0.1.1" 1473 | } 1474 | }, 1475 | "string_decoder": { 1476 | "version": "0.10.31", 1477 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", 1478 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", 1479 | "dev": true 1480 | }, 1481 | "string-width": { 1482 | "version": "1.0.2", 1483 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", 1484 | "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", 1485 | "dev": true, 1486 | "requires": { 1487 | "code-point-at": "1.1.0", 1488 | "is-fullwidth-code-point": "1.0.0", 1489 | "strip-ansi": "3.0.1" 1490 | } 1491 | }, 1492 | "string.prototype.padend": { 1493 | "version": "3.0.0", 1494 | "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz", 1495 | "integrity": "sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA=", 1496 | "dev": true, 1497 | "requires": { 1498 | "define-properties": "1.1.2", 1499 | "es-abstract": "1.9.0", 1500 | "function-bind": "1.1.1" 1501 | } 1502 | }, 1503 | "strip-ansi": { 1504 | "version": "3.0.1", 1505 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 1506 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 1507 | "dev": true, 1508 | "requires": { 1509 | "ansi-regex": "2.1.1" 1510 | } 1511 | }, 1512 | "strip-bom": { 1513 | "version": "3.0.0", 1514 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", 1515 | "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", 1516 | "dev": true 1517 | }, 1518 | "strip-json-comments": { 1519 | "version": "2.0.1", 1520 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 1521 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", 1522 | "dev": true 1523 | }, 1524 | "supports-color": { 1525 | "version": "2.0.0", 1526 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", 1527 | "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", 1528 | "dev": true 1529 | }, 1530 | "table": { 1531 | "version": "3.8.3", 1532 | "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", 1533 | "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", 1534 | "dev": true, 1535 | "requires": { 1536 | "ajv": "4.11.8", 1537 | "ajv-keywords": "1.5.1", 1538 | "chalk": "1.1.3", 1539 | "lodash": "4.17.4", 1540 | "slice-ansi": "0.0.4", 1541 | "string-width": "2.1.1" 1542 | }, 1543 | "dependencies": { 1544 | "ansi-regex": { 1545 | "version": "3.0.0", 1546 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 1547 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", 1548 | "dev": true 1549 | }, 1550 | "is-fullwidth-code-point": { 1551 | "version": "2.0.0", 1552 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 1553 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 1554 | "dev": true 1555 | }, 1556 | "string-width": { 1557 | "version": "2.1.1", 1558 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 1559 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 1560 | "dev": true, 1561 | "requires": { 1562 | "is-fullwidth-code-point": "2.0.0", 1563 | "strip-ansi": "4.0.0" 1564 | } 1565 | }, 1566 | "strip-ansi": { 1567 | "version": "4.0.0", 1568 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 1569 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 1570 | "dev": true, 1571 | "requires": { 1572 | "ansi-regex": "3.0.0" 1573 | } 1574 | } 1575 | } 1576 | }, 1577 | "text-table": { 1578 | "version": "0.2.0", 1579 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", 1580 | "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", 1581 | "dev": true 1582 | }, 1583 | "through": { 1584 | "version": "2.3.8", 1585 | "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 1586 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", 1587 | "dev": true 1588 | }, 1589 | "tryit": { 1590 | "version": "1.0.3", 1591 | "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", 1592 | "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", 1593 | "dev": true 1594 | }, 1595 | "type-check": { 1596 | "version": "0.3.2", 1597 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", 1598 | "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", 1599 | "dev": true, 1600 | "requires": { 1601 | "prelude-ls": "1.1.2" 1602 | } 1603 | }, 1604 | "typedarray": { 1605 | "version": "0.0.6", 1606 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 1607 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", 1608 | "dev": true 1609 | }, 1610 | "user-home": { 1611 | "version": "2.0.0", 1612 | "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", 1613 | "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", 1614 | "dev": true, 1615 | "requires": { 1616 | "os-homedir": "1.0.2" 1617 | } 1618 | }, 1619 | "util-deprecate": { 1620 | "version": "1.0.2", 1621 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1622 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 1623 | "dev": true 1624 | }, 1625 | "validate-npm-package-license": { 1626 | "version": "3.0.1", 1627 | "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", 1628 | "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", 1629 | "dev": true, 1630 | "requires": { 1631 | "spdx-correct": "1.0.2", 1632 | "spdx-expression-parse": "1.0.4" 1633 | } 1634 | }, 1635 | "which": { 1636 | "version": "1.3.0", 1637 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", 1638 | "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", 1639 | "dev": true, 1640 | "requires": { 1641 | "isexe": "2.0.0" 1642 | } 1643 | }, 1644 | "wordwrap": { 1645 | "version": "1.0.0", 1646 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", 1647 | "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", 1648 | "dev": true 1649 | }, 1650 | "wrappy": { 1651 | "version": "1.0.2", 1652 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1653 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1654 | }, 1655 | "write": { 1656 | "version": "0.2.1", 1657 | "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", 1658 | "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", 1659 | "dev": true, 1660 | "requires": { 1661 | "mkdirp": "0.5.1" 1662 | } 1663 | }, 1664 | "xtend": { 1665 | "version": "4.0.1", 1666 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", 1667 | "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", 1668 | "dev": true 1669 | }, 1670 | "yallist": { 1671 | "version": "2.1.2", 1672 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", 1673 | "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", 1674 | "dev": true 1675 | } 1676 | } 1677 | } 1678 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@elm-node/core", 3 | "version": "3.0.1", 4 | "description": "Native bindings to Node.js's core libraries.", 5 | "scripts": { 6 | "test": "npm-run-all test:*", 7 | "test:Buffer": "elm-make test/Buffer/Main.elm --output test/Buffer/main.js && node test/Buffer/index.js", 8 | "test:ChildProcess": "elm-make test/ChildProcess/Main.elm --output test/ChildProcess/main.js && node test/ChildProcess/index.js", 9 | "test:Crypto": "elm-make test/Crypto/Main.elm --output test/Crypto/main.js && node test/Crypto/index.js", 10 | "test:FileSystem": "elm-make test/FileSystem/Main.elm --output test/FileSystem/main.js && node test/FileSystem/index.js", 11 | "test:Global": "elm-make test/Global/Main.elm --output test/Global/main.js && node test/Global/index.js", 12 | "test:OperatingSystem": "elm-make test/OperatingSystem/Main.elm --output test/OperatingSystem/main.js && node test/OperatingSystem/index.js", 13 | "test:Path": "elm-make test/Path/Main.elm --output test/Path/main.js && node test/Path/index.js", 14 | "test:Process": "elm-make test/Process/Main.elm --output test/Process/main.js && node test/Process/index.js" 15 | }, 16 | "repository": "elm-node/core", 17 | "author": "Alexandre Gigliotti ", 18 | "license": "Unlicense", 19 | "dependencies": { 20 | "cpr": "^2.0.2", 21 | "mkdirp": "^0.5.1", 22 | "rimraf": "^2.6.1" 23 | }, 24 | "devDependencies": { 25 | "eslint": "^3.19.0", 26 | "eslint-config-elm": "^2.0.0", 27 | "npm-run-all": "^4.0.2" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Native/Buffer.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_Buffer = function () { 2 | const Ok = _elm_lang$core$Result$Ok 3 | const Err = _elm_lang$core$Result$Err 4 | const { Buffer } = require("buffer") 5 | const { StringDecoder } = require("string_decoder") 6 | 7 | 8 | // fromString : String -> String -> Result Error Buffer 9 | const fromString = F2((encoding, string) => { 10 | try { 11 | const buffer = Buffer.from(string, encoding) 12 | return Ok(buffer) 13 | } catch (error) { return Err(error) } 14 | }) 15 | 16 | 17 | // toString : String -> Buffer -> Result Error String 18 | const toString = F2((encoding, buffer) => { 19 | try { 20 | const decoder = new StringDecoder(encoding) 21 | const string = decoder.end(buffer) 22 | return Ok(string) 23 | } catch (error) { return Err(error) } 24 | }) 25 | 26 | 27 | const exports = 28 | { fromString 29 | , toString 30 | } 31 | return exports 32 | }() 33 | -------------------------------------------------------------------------------- /src/Native/ChildProcess.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_ChildProcess = function () { 2 | const ChildProcess = require("child_process") 3 | const Just = _elm_lang$core$Maybe$Just 4 | const Nothing = _elm_lang$core$Maybe$Nothing 5 | const { fromList, toJSArray } = _elm_lang$core$Native_Array 6 | const { nativeBinding, succeed, fail } = _elm_lang$core$Native_Scheduler 7 | const { Tuple2 } = _elm_lang$core$Native_Utils 8 | 9 | 10 | // spawn : String -> List String -> Bool -> Task Decode.Value (Maybe Int, Maybe String) 11 | const spawn = F3((command, argsList, silent) => nativeBinding(callback => { 12 | try { 13 | const args = toJSArray(fromList(argsList)) 14 | const subprocess = ChildProcess.spawn(command, args, { shell : true }) 15 | if (!silent) { 16 | subprocess.stderr.pipe(process.stderr) 17 | subprocess.stdout.pipe(process.stdout) 18 | } 19 | // error: process could not be spawned ... 20 | let error 21 | subprocess.on("error", error2 => { 22 | try { 23 | error = error2 24 | } catch (error3) { error = error3 } 25 | }) 26 | // close: all io streams closed, always emitted after error ... 27 | // one of code or signal will be non-null 28 | subprocess.on("close", (code, signal) => { 29 | try { 30 | if (error) return callback(fail(error)) 31 | return callback(succeed(Tuple2( 32 | code === null ? Nothing : Just(code), 33 | signal === null ? Nothing : Just(signal) 34 | ))) 35 | } catch (error2) { return callback(fail(error2)) } 36 | }) 37 | } catch (error) { return callback(fail(error)) } 38 | })) 39 | 40 | 41 | const exports = 42 | { spawn 43 | } 44 | return exports 45 | }() 46 | -------------------------------------------------------------------------------- /src/Native/Crypto.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_Crypto = function () { 2 | const Ok = _elm_lang$core$Result$Ok 3 | const Err = _elm_lang$core$Result$Err 4 | const { nativeBinding, fail, succeed } = _elm_lang$core$Native_Scheduler 5 | const crypto = require("crypto") 6 | const { Buffer } = require("buffer") 7 | 8 | 9 | // encrypt : String -> String -> Buffer -> Result Decode.Value Buffer 10 | const encrypt = F3((algorithm, password, data) => { 11 | try { 12 | const cipher = crypto.createCipher(algorithm, password) 13 | const encrypted = Buffer.concat([ cipher.update(data), cipher.final() ]) 14 | return Ok(encrypted) 15 | } catch (error) { return Err(error) } 16 | }) 17 | 18 | 19 | // decrypt : String -> String -> Buffer -> Result Decode.Value Buffer 20 | const decrypt = F3((algorithm, password, data) => { 21 | try { 22 | const decipher = crypto.createDecipher(algorithm, password) 23 | const decrypted = Buffer.concat([ decipher.update(data), decipher.final() ]) 24 | return Ok(decrypted) 25 | } catch (error) { return Err(error) } 26 | }) 27 | 28 | 29 | // randomBytes : Int -> Task Decode.Value Buffer 30 | const randomBytes = size => nativeBinding(callback => { 31 | try { 32 | crypto.randomBytes(size, (error, buffer) => { 33 | if (error) return callback(fail(error)) 34 | return callback(succeed(buffer)) 35 | }) 36 | } catch (error) { return callback(fail(error)) } 37 | }) 38 | 39 | 40 | const exports = 41 | { encrypt 42 | , decrypt 43 | , randomBytes 44 | } 45 | return exports 46 | }() 47 | -------------------------------------------------------------------------------- /src/Native/FileSystem.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_FileSystem = (_ => { 2 | const cpr = require( "cpr" ) 3 | const fs = require( "fs" ) 4 | const mkdirp_ = require("mkdirp") 5 | const rm = require("rimraf") 6 | const { nativeBinding, succeed, fail } = _elm_lang$core$Native_Scheduler 7 | const { Tuple0 } = _elm_lang$core$Native_Utils 8 | 9 | 10 | // copy : Bool -> String -> String -> Task Decode.Value Decode.Value 11 | const copy = F3((overwrite, to, from) => nativeBinding(callback => { 12 | try { 13 | const extractFilename = message => { 14 | const match = (/(?:File ){0,1}(.*) exists/).exec(message) 15 | return match ? match[1] : null 16 | } 17 | cpr(from, to, { overwrite }, (error, files) => { 18 | try { 19 | // single file case 20 | if (error && !files) { 21 | const filename = extractFilename(error.message) 22 | if (filename) return callback(succeed({ errors : [ error ], files : [ filename ] })) 23 | return callback(fail(error)) 24 | } 25 | // multiple file case 26 | if (error && files) return callback(succeed({ errors : error.list, files })) 27 | // copying a single file with no errors returns files and error undefined ... 28 | return callback(succeed({ errors : [], files : files || [ to ] })) 29 | } catch (error2) { return callback(fail(error2)) } 30 | }) 31 | } catch (error) { return callback(fail(error)) } 32 | })) 33 | 34 | 35 | // exists : String -> Task Decode.Value Bool 36 | const exists = path => nativeBinding(callback => { 37 | try { 38 | fs.access(path, fs.constants.F_OK, error => callback(error ? succeed(false) : succeed(true))) 39 | } 40 | catch (error) { return callback(fail(error)) } 41 | }) 42 | 43 | 44 | // mkdirp : String -> Task Decode.Value () 45 | const mkdirp = filename => nativeBinding(callback => { 46 | try { 47 | mkdirp_(filename, error => callback(error ? fail(error) : succeed(Tuple0))) 48 | } 49 | catch (error) { return callback(fail(error)) } 50 | }) 51 | 52 | 53 | // readFile : String -> Task Decode.Value Buffer 54 | const readFile = filename => nativeBinding(callback => { 55 | try { 56 | fs.readFile(filename, (error, buffer) => { 57 | if (error) return callback(fail(error)) 58 | return callback(succeed(buffer)) 59 | }) 60 | } catch (error) { return callback(fail(error)) } 61 | }) 62 | 63 | 64 | // remove : String -> Task Decode.Value () 65 | const remove = filename => nativeBinding(callback => { 66 | try { 67 | rm(filename, error => { 68 | if (error) return callback(fail(error)) 69 | return callback(succeed(Tuple0)) 70 | }) 71 | } catch (error) { return callback(fail(error)) } 72 | }) 73 | 74 | 75 | // rename : String -> String -> Task Decode.Value () 76 | const rename = F2((from, to) => nativeBinding(callback => { 77 | try { 78 | fs.rename(from, to, error => callback(error ? fail(error) : succeed(Tuple0))) 79 | } 80 | catch (error) { return callback(fail(error)) } 81 | })) 82 | 83 | 84 | // stat : String -> Task Decode.Value Decode.Value 85 | const stat = path => nativeBinding(callback => { 86 | try { 87 | fs.lstat(path, (error, stats) => { 88 | try { 89 | if (error) return callback(fail(error)) 90 | const result = 91 | { isDirectory : stats.isDirectory() 92 | , isFile : stats.isFile() 93 | , isSocket : stats.isSocket() 94 | , isSymbolicLink : stats.isSymbolicLink() 95 | , size : stats.size 96 | , mode : stats.mode 97 | , atimeMs : stats.atimeMs 98 | , mtimeMs : stats.mtimeMs 99 | , ctimeMs : stats.ctimeMs 100 | , birthtimeMs : stats.birthtimeMs 101 | } 102 | return callback(succeed(result)) 103 | } catch (error2) { return callback(fail(error2)) } 104 | }) 105 | } catch (error) { return callback(fail(error)) } 106 | }) 107 | 108 | 109 | // symbolicLink : String -> String -> String -> Task Decode.Value () 110 | const symlink = F3((from, to, type) => nativeBinding(callback => { 111 | try { 112 | fs.symlink(from, to, type, error => callback(error ? fail(error) : succeed(Tuple0))) 113 | } 114 | catch (error) { return callback(fail(error)) } 115 | })) 116 | 117 | 118 | // writeFile : String -> Int -> Buffer -> Task Decode.Value () 119 | const writeFile = F3((path, mode, buffer) => nativeBinding(callback => { 120 | try { 121 | const options = { mode } 122 | fs.writeFile(path, buffer, options, error => { 123 | if (error) return callback(fail(error)) 124 | return callback(succeed(Tuple0)) 125 | }) 126 | } catch (error) { return callback(fail(error)) } 127 | })) 128 | 129 | 130 | const exports = 131 | { copy 132 | , exists 133 | , mkdirp 134 | , readFile 135 | , remove 136 | , rename 137 | , stat 138 | , symlink 139 | , writeFile 140 | } 141 | return exports 142 | })() 143 | -------------------------------------------------------------------------------- /src/Native/Global.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_Global = function () { 2 | const Err = _elm_lang$core$Result$Err 3 | const Ok = _elm_lang$core$Result$Ok 4 | 5 | 6 | // parseInt : Int -> String -> Result Decode.Value Int 7 | const parseInt = F2((radix, string) => { 8 | try { 9 | // radix can be any integer from 2-36 10 | const value = global.parseInt(string, radix) 11 | if (isNaN(value)) return Err(new Error(`String cannot be converted to an integer: ${string}`)) 12 | return Ok(value) 13 | } catch (error) { return Err(error) } 14 | }) 15 | 16 | 17 | // toString : Int -> Int -> Result Decode.Value String 18 | const toString = F2((radix, integer) => { 19 | try { 20 | const value = Number.prototype.toString.call(integer, radix) 21 | return Ok(value) 22 | } catch (error) { return Err(error) } 23 | }) 24 | 25 | 26 | const exports = 27 | { toString 28 | , parseInt 29 | } 30 | return exports 31 | }() 32 | -------------------------------------------------------------------------------- /src/Native/OperatingSystem.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_OperatingSystem = function () { 2 | const Err = _elm_lang$core$Result$Err 3 | const Ok = _elm_lang$core$Result$Ok 4 | const os = require("os") 5 | 6 | 7 | // homedir : String 8 | const homedir = os.homedir() 9 | 10 | 11 | // platform : String 12 | const platform = os.platform() 13 | 14 | 15 | // tmpdir : String 16 | const tmpdir = os.tmpdir() 17 | 18 | 19 | const exports = 20 | { homedir 21 | , platform 22 | , tmpdir 23 | } 24 | return exports 25 | }() 26 | -------------------------------------------------------------------------------- /src/Native/Path.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_Path = function () { 2 | const { fromList, toJSArray } = _elm_lang$core$Native_Array 3 | const path = require("path") 4 | 5 | 6 | // basename : String -> String 7 | const basename = path.basename 8 | 9 | 10 | // delimiter : String 11 | const delimiter = path.delimiter 12 | 13 | 14 | // dirname : String -> String 15 | const dirname = path.dirname 16 | 17 | 18 | // extname : String -> String 19 | const extname = path.extname 20 | 21 | 22 | // join : List String -> String 23 | const join = list => path.join.apply(path, toJSArray(fromList(list))) 24 | 25 | 26 | // sep : String 27 | const sep = path.sep 28 | 29 | 30 | const exports = 31 | { basename 32 | , delimiter 33 | , dirname 34 | , extname 35 | , join 36 | , sep 37 | } 38 | return exports 39 | }() 40 | -------------------------------------------------------------------------------- /src/Native/Process.js: -------------------------------------------------------------------------------- 1 | const _elm_node$core$Native_Process = function () { 2 | if (!process) throw Error("Process requires a Node.js compatible runtime: `process` global not found.") 3 | 4 | 5 | const { nativeBinding, succeed, fail } = _elm_lang$core$Native_Scheduler 6 | 7 | 8 | // cwd : () -> Task Decode.Value String 9 | const cwd = () => nativeBinding(callback => { 10 | // NOT pure since cwd can be changed by `process.chdir` => Task 11 | try { 12 | const dirname = process.cwd() 13 | return callback(succeed(dirname)) 14 | } catch (error) { return callback(fail(error)) } 15 | }) 16 | 17 | 18 | // env : Decode.Value 19 | const env = process.env 20 | 21 | 22 | const exports = 23 | { cwd 24 | , env 25 | } 26 | return exports 27 | }() 28 | -------------------------------------------------------------------------------- /src/Node/Buffer.elm: -------------------------------------------------------------------------------- 1 | module Node.Buffer 2 | exposing 3 | ( Buffer 4 | , fromString 5 | , toString 6 | ) 7 | 8 | {-| Native bindings for Buffer module. 9 | 10 | @docs Buffer , fromString , toString 11 | 12 | -} 13 | 14 | import Node.Buffer.LowLevel as LowLevel exposing (Buffer) 15 | import Node.Encoding as Encoding exposing (Encoding) 16 | import Node.Error as Error exposing (Error) 17 | 18 | 19 | {-| Buffer type. 20 | -} 21 | type alias Buffer = 22 | LowLevel.Buffer 23 | 24 | 25 | {-| Convert a String to a Buffer. 26 | -} 27 | fromString : Encoding -> String -> Result Error Buffer 28 | fromString encoding data = 29 | LowLevel.fromString (Encoding.toString encoding) data 30 | |> Result.mapError Error.fromValue 31 | 32 | 33 | {-| Convert a Buffer to a String. 34 | -} 35 | toString : Encoding -> Buffer -> Result Error String 36 | toString encoding data = 37 | LowLevel.toString (Encoding.toString encoding) data 38 | |> Result.mapError Error.fromValue 39 | -------------------------------------------------------------------------------- /src/Node/Buffer/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.Buffer.LowLevel 2 | exposing 3 | ( Buffer 4 | , fromString 5 | , toString 6 | ) 7 | 8 | import Json.Decode as Decode 9 | import Native.Buffer 10 | 11 | 12 | type Buffer 13 | = Buffer 14 | 15 | 16 | fromString : String -> String -> Result Decode.Value Buffer 17 | fromString = 18 | Native.Buffer.fromString 19 | 20 | 21 | toString : String -> Buffer -> Result Decode.Value String 22 | toString = 23 | Native.Buffer.toString 24 | -------------------------------------------------------------------------------- /src/Node/ChildProcess.elm: -------------------------------------------------------------------------------- 1 | module Node.ChildProcess 2 | exposing 3 | ( Output(..) 4 | , Exit(..) 5 | , spawn 6 | ) 7 | 8 | {-| Child Process 9 | 10 | @docs Output , Exit , spawn 11 | 12 | -} 13 | 14 | import Node.ChildProcess.LowLevel as LowLevel 15 | import Node.Error as Error exposing (Error) 16 | import Regex 17 | import Task exposing (Task) 18 | 19 | 20 | {-| Output type. 21 | -} 22 | type Output 23 | = Silent 24 | | Verbose 25 | 26 | 27 | {-| Exit type. 28 | -} 29 | type Exit 30 | = Code Int 31 | | Signal String 32 | 33 | 34 | {-| Spawn a child process by running the given command. 35 | -} 36 | spawn : String -> Output -> Task Error Exit 37 | spawn command output = 38 | --QUESTION flip signature to read `spawn output command`? 39 | let 40 | silent = 41 | case output of 42 | Silent -> 43 | True 44 | 45 | Verbose -> 46 | False 47 | 48 | ( cmd, args ) = 49 | case Regex.split Regex.All (Regex.regex "\\s+") command of 50 | [] -> 51 | ( "", [] ) 52 | 53 | cmd :: args -> 54 | ( cmd, args ) 55 | in 56 | LowLevel.spawn cmd args silent 57 | |> Task.mapError Error.fromValue 58 | |> Task.andThen 59 | (\( code, signal ) -> 60 | case ( code, signal ) of 61 | ( Just code, Nothing ) -> 62 | Task.succeed <| Code code 63 | 64 | ( Nothing, Just signal ) -> 65 | Task.succeed <| Signal signal 66 | 67 | ( Nothing, Nothing ) -> 68 | Task.fail <| Error.Error "Invalid response: Both code and signal are Nothing. Please report this as a bug." "" 69 | 70 | ( Just code, Just signal ) -> 71 | Task.fail <| Error.Error ("Invalid response: Both code and signal have values: ( code, signal ) = ( " ++ toString code ++ ", " ++ toString signal ++ " ). Please report this as a bug.") "" 72 | ) 73 | -------------------------------------------------------------------------------- /src/Node/ChildProcess/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.ChildProcess.LowLevel 2 | exposing 3 | ( spawn 4 | ) 5 | 6 | import Native.ChildProcess 7 | import Json.Decode as Decode 8 | import Task exposing (Task) 9 | 10 | 11 | spawn : String -> List String -> Bool -> Task Decode.Value ( Maybe Int, Maybe String ) 12 | spawn = 13 | Native.ChildProcess.spawn 14 | -------------------------------------------------------------------------------- /src/Node/Crypto.elm: -------------------------------------------------------------------------------- 1 | module Node.Crypto 2 | exposing 3 | ( Cipher(..) 4 | , decrypt 5 | , encrypt 6 | , randomBytes 7 | ) 8 | 9 | {-| Native bindings for Node's Crypto module. 10 | 11 | @docs Cipher , decrypt , encrypt , randomBytes 12 | 13 | -} 14 | 15 | import Node.Buffer as Buffer exposing (Buffer) 16 | import Node.Crypto.LowLevel as LowLevel 17 | import Node.Error as Error exposing (Error(..)) 18 | import List.Extra as List 19 | import Task exposing (Task) 20 | import Tuple 21 | 22 | 23 | {- Notes: 24 | 25 | Modes 26 | - CBC: Cipher Block Chaining 27 | - CFB: Cipher Feedback 28 | - CNT: Counter 29 | - ECB: Electronic Cookbook 30 | - OFB: Output Feedback 31 | 32 | aes-128 = cipher 33 | cbc = mode 34 | not all ciphers support modes 35 | -} 36 | 37 | 38 | {-| Cipher types supported by [Openssl](https://www.openssl.org/docs/man1.0.2/apps/enc.html). 39 | -} 40 | type Cipher 41 | = Aes128 42 | | Aes128CipherBlockChaining 43 | | Aes128CipherFeedback 44 | | Aes128CipherFeedback1 45 | | Aes128CipherFeedback8 46 | | Aes128ElectronicCookbook 47 | | Aes128OutputFeedback 48 | | Aes192 49 | | Aes192CipherBlockChaining 50 | | Aes192CipherFeedback 51 | | Aes192CipherFeedback1 52 | | Aes192CipherFeedback8 53 | | Aes192ElectronicCookbook 54 | | Aes192OutputFeedback 55 | | Aes256 56 | | Aes256CipherBlockChaining 57 | | Aes256CipherFeedback 58 | | Aes256CipherFeedback1 59 | | Aes256CipherFeedback8 60 | | Aes256ElectronicCookbook 61 | | Aes256OutputFeedback 62 | | Base64 63 | | Bf 64 | | BfCipherBlockChaining 65 | | BfCipherFeedback 66 | | BfElectronicCookbook 67 | | BfOutputFeedback 68 | | Cast 69 | | CastCipherBlockChaining 70 | | Cast5CipherBlockChaining 71 | | Cast5CipherFeedback 72 | | Cast5ElectronicCookbook 73 | | Cast5OutputFeedback 74 | | Des 75 | | DesCipherBlockChaining 76 | | DesCipherFeedback 77 | | DesElectronicCookbook 78 | | DesOutputFeedback 79 | | DesEde 80 | | DesEdeCipherBlockChaining 81 | | DesEdeCipherFeedback 82 | | DesEdeOutputFeedback 83 | | Des3 84 | | DesEde3 85 | | DesEde3CipherBlockChaining 86 | | DesEde3CipherFeedback 87 | | DesEde3OutputFeedback 88 | | Desx 89 | | Gost89 90 | | Gost89CNT 91 | | Idea 92 | | IdeaCipherBlockChaining 93 | | IdeaCipherFeedback 94 | | IdeaElectronicCookbook 95 | | IdeaOutputFeedback 96 | | Rc2 97 | | Rc2CipherBlockChaining 98 | | Rc2CipherFeedback 99 | | Rc2ElectronicCookbook 100 | | Rc2OutputFeedback 101 | | Rc240CipherBlockChaining 102 | | Rc264CipherBlockChaining 103 | | Rc4 104 | | Rc440 105 | | Rc464 106 | | Rc5 107 | | Rc5CipherBlockChaining 108 | | Rc5CipherFeedback 109 | | Rc5ElectronicCookbook 110 | | Rc5OutputFeedback 111 | | None 112 | 113 | 114 | cipherMap : List ( Cipher, String ) 115 | cipherMap = 116 | [ ( Aes128, "aes128" ) -- = aes-128-cbc 117 | , ( Aes128CipherBlockChaining, "aes-128-cbc" ) 118 | , ( Aes128CipherFeedback, "aes-128-cfb" ) 119 | , ( Aes128CipherFeedback1, "aes-128-cfb1" ) 120 | , ( Aes128CipherFeedback8, "aes-128-cfb8" ) 121 | , ( Aes128ElectronicCookbook, "aes-128-ecb" ) 122 | , ( Aes128OutputFeedback, "aes-128-ofb" ) 123 | , ( Aes192, "aes192" ) -- = aes-192-cbc 124 | , ( Aes192CipherBlockChaining, "aes-192-cbc" ) 125 | , ( Aes192CipherFeedback, "aes-192-cfb" ) 126 | , ( Aes192CipherFeedback1, "aes-192-cfb1" ) 127 | , ( Aes192CipherFeedback8, "aes-192-cfb8" ) 128 | , ( Aes192ElectronicCookbook, "aes-192-ecb" ) 129 | , ( Aes192OutputFeedback, "aes-192-ofb" ) 130 | , ( Aes256, "aes256" ) -- = aes-256-cbc 131 | , ( Aes256CipherBlockChaining, "aes-256-cbc" ) 132 | , ( Aes256CipherFeedback, "aes-256-cfb" ) 133 | , ( Aes256CipherFeedback1, "aes-256-cfb1" ) 134 | , ( Aes256CipherFeedback8, "aes-256-cfb8" ) 135 | , ( Aes256ElectronicCookbook, "aes-256-ecb" ) 136 | , ( Aes256OutputFeedback, "aes-256-ofb" ) 137 | , ( Base64, "base64" ) -- no mode ... 138 | , ( Bf, "bf" ) -- = bf-cbc 139 | , ( BfCipherBlockChaining, "bf-cbc" ) 140 | , ( BfCipherFeedback, "bf-cfb" ) 141 | , ( BfElectronicCookbook, "bf-ecb" ) 142 | , ( BfOutputFeedback, "bf-ofb" ) 143 | , ( Cast, "cast" ) -- = cast-cbc 144 | , ( CastCipherBlockChaining, "cast-cbc" ) 145 | , ( Cast5CipherBlockChaining, "cast5-cbc" ) 146 | , ( Cast5CipherFeedback, "cast5-cfb" ) 147 | , ( Cast5ElectronicCookbook, "cast5-ecb" ) 148 | , ( Cast5OutputFeedback, "cast5-ofb" ) 149 | , ( Des, "des" ) -- = des-cbc 150 | , ( DesCipherBlockChaining, "des-cbc" ) 151 | , ( DesCipherFeedback, "des-cfb" ) 152 | , ( DesElectronicCookbook, "des-ecb" ) 153 | , ( DesOutputFeedback, "des-ofb" ) 154 | , ( DesEde, "des-ede" ) -- = des-ede-ecb 155 | , ( DesEdeCipherBlockChaining, "des-ede-cbc" ) 156 | , ( DesEdeCipherFeedback, "des-ede-cfb" ) 157 | , ( DesEdeOutputFeedback, "des-ede-ofb" ) 158 | , ( Des3, "des3" ) -- = des-ede3-cbc 159 | , ( DesEde3, "des-ede3" ) -- = des-ede3-ecb 160 | , ( DesEde3CipherBlockChaining, "des-ede3-cbc" ) 161 | , ( DesEde3CipherFeedback, "des-ede3-cfb" ) 162 | , ( DesEde3OutputFeedback, "des-ede3-ofb" ) 163 | , ( Desx, "desx" ) -- no mode ... 164 | , ( Gost89, "gost89" ) -- = Gost89 in CFB mode, mode but no `-mode` in name 165 | , ( Gost89CNT, "gost89-cnt" ) 166 | , ( Idea, "idea" ) -- = idea-cbc 167 | , ( IdeaCipherBlockChaining, "idea-cbc" ) 168 | , ( IdeaCipherFeedback, "idea-cfc" ) 169 | , ( IdeaElectronicCookbook, "idea-ecb" ) 170 | , ( IdeaOutputFeedback, "idea-ofb" ) 171 | , ( Rc2, "rc2" ) -- = rc2-cbc, 128 bit Rc2 172 | , ( Rc2CipherBlockChaining, "rc2-cbc" ) -- 128 bit Rc2 173 | , ( Rc2CipherFeedback, "rc2-cfb" ) -- 128 bit Rc2 174 | , ( Rc2ElectronicCookbook, "rc2-ecb" ) -- 128 bit Rc2 175 | , ( Rc2OutputFeedback, "rc2-ofb" ) -- 128 bit Rc2 176 | , ( Rc240CipherBlockChaining, "rc2-40-cbc" ) -- 40 bit Rc2 177 | , ( Rc264CipherBlockChaining, "rc2-64-cbc" ) -- 64 bit Rc2 178 | , ( Rc4, "rc4" ) -- 128 bit Rc4, no mode ... 179 | , ( Rc440, "rc4-40" ) -- 40 bit Rc4, no mode ... 180 | , ( Rc464, "rc4-64" ) -- 64 bit Rc4, no mode ... 181 | , ( Rc5, "rc5" ) -- = rc5-cbc 182 | , ( Rc5CipherBlockChaining, "rc5-cbc" ) 183 | , ( Rc5CipherFeedback, "rc5-cfb" ) 184 | , ( Rc5ElectronicCookbook, "rc5-ecb" ) 185 | , ( Rc5OutputFeedback, "rc5-ofb" ) 186 | , ( None, "none" ) -- no mode ... 187 | ] 188 | 189 | 190 | cipherToString : Cipher -> Result Error String 191 | cipherToString cipher = 192 | cipherMap 193 | |> List.find (Tuple.first >> (==) cipher) 194 | |> Maybe.map (Tuple.second >> Ok) 195 | |> Maybe.withDefault (Err <| Error "Crypto" "Cipher could not be found.") 196 | 197 | 198 | {-| Encrypt a Buffer. 199 | -} 200 | encrypt : Cipher -> String -> Buffer -> Result Error Buffer 201 | encrypt cipher password buffer = 202 | cipherToString cipher 203 | |> Result.andThen 204 | (\algorithm -> 205 | LowLevel.encrypt algorithm password buffer 206 | |> Result.mapError Error.fromValue 207 | ) 208 | 209 | 210 | {-| Decrypt a Buffer. 211 | -} 212 | decrypt : Cipher -> String -> Buffer -> Result Error Buffer 213 | decrypt cipher password buffer = 214 | cipherToString cipher 215 | |> Result.andThen 216 | (\algorithm -> 217 | LowLevel.decrypt algorithm password buffer 218 | |> Result.mapError Error.fromValue 219 | ) 220 | 221 | 222 | {-| Generate cryptographically strong pseudo-random data. 223 | -} 224 | randomBytes : Int -> Task Error Buffer 225 | randomBytes size = 226 | LowLevel.randomBytes size 227 | |> Task.mapError Error.fromValue 228 | -------------------------------------------------------------------------------- /src/Node/Crypto/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.Crypto.LowLevel 2 | exposing 3 | ( encrypt 4 | , decrypt 5 | , randomBytes 6 | ) 7 | 8 | import Node.Buffer exposing (Buffer) 9 | import Json.Decode as Decode 10 | import Task exposing (Task) 11 | import Native.Crypto 12 | 13 | 14 | encrypt : String -> String -> Buffer -> Result Decode.Value Buffer 15 | encrypt = 16 | Native.Crypto.encrypt 17 | 18 | 19 | decrypt : String -> String -> Buffer -> Result Decode.Value Buffer 20 | decrypt = 21 | Native.Crypto.decrypt 22 | 23 | 24 | randomBytes : Int -> Task Decode.Value Buffer 25 | randomBytes = 26 | Native.Crypto.randomBytes 27 | -------------------------------------------------------------------------------- /src/Node/Encoding.elm: -------------------------------------------------------------------------------- 1 | module Node.Encoding 2 | exposing 3 | ( Encoding(..) 4 | , toString 5 | ) 6 | 7 | {-| String encodings supported by Node.js. 8 | 9 | @docs Encoding , toString 10 | 11 | -} 12 | 13 | import String 14 | 15 | 16 | {-| Encoding union type. 17 | -} 18 | type Encoding 19 | = Ascii 20 | | Utf8 21 | | Utf16le 22 | | Base64 23 | | Latin1 24 | | Hex 25 | 26 | 27 | {-| Convert encoding to string. 28 | -} 29 | toString : Encoding -> String 30 | toString = 31 | Basics.toString >> String.toLower 32 | -------------------------------------------------------------------------------- /src/Node/Error.elm: -------------------------------------------------------------------------------- 1 | module Node.Error 2 | exposing 3 | ( Error(..) 4 | , message 5 | , decoder 6 | , fromValue 7 | , Code(..) 8 | ) 9 | 10 | {-| Error type. 11 | 12 | @docs Error , message , decoder , fromValue , Code 13 | 14 | -} 15 | 16 | import Json.Decode as Decode 17 | import Json.Decode.Extra as Decode 18 | import List.Extra as List 19 | import Result.Extra as Result 20 | 21 | 22 | {-| Error union type. 23 | -} 24 | type Error 25 | = Error String String 26 | | SystemError 27 | Code 28 | { message : String 29 | , stack : String 30 | , syscall : String 31 | , path : Maybe String 32 | , address : Maybe String 33 | , port_ : Maybe String 34 | } 35 | 36 | 37 | {-| Extract the message from an Error. 38 | -} 39 | message : Error -> String 40 | message error = 41 | case error of 42 | Error message _ -> 43 | message 44 | 45 | SystemError _ { message } -> 46 | message 47 | 48 | 49 | {-| Error decoder. 50 | -} 51 | decoder : Decode.Decoder Error 52 | decoder = 53 | Decode.maybe (Decode.field "code" Decode.string) 54 | |> Decode.andThen 55 | (\code -> 56 | case code of 57 | Just code -> 58 | Decode.map7 59 | (\message stack code syscall path address port_ -> 60 | SystemError code 61 | { message = message 62 | , stack = stack 63 | , syscall = syscall 64 | , path = path 65 | , address = address 66 | , port_ = port_ 67 | } 68 | ) 69 | (Decode.field "message" Decode.string) 70 | (Decode.field "stack" Decode.string) 71 | (Decode.field "code" <| Decode.andThen (codeFromString >> Decode.fromResult) Decode.string) 72 | (Decode.field "syscall" Decode.string) 73 | (Decode.maybe <| Decode.field "path" Decode.string) 74 | (Decode.maybe <| Decode.field "address" Decode.string) 75 | (Decode.maybe <| Decode.field "port" Decode.string) 76 | 77 | Nothing -> 78 | Decode.map2 Error 79 | (Decode.field "message" Decode.string) 80 | (Decode.field "stack" Decode.string) 81 | ) 82 | 83 | 84 | {-| Decode an Error from a Value. 85 | -} 86 | fromValue : Decode.Value -> Error 87 | fromValue value = 88 | Decode.decodeValue decoder value 89 | |> Result.extract (\error -> Error ("Decoding Error: " ++ error ++ " value failed: " ++ toString value) error) 90 | 91 | 92 | {-| Error code union type. 93 | -} 94 | type Code 95 | = ArgumentListTooLong --E2BIG 96 | | PermissionDenied --EACCES 97 | | AddressInUse --EADDRINUSE 98 | | AddressNotAvailable --EADDRNOTAVAIL 99 | | AddressFamilyNotSupported --EAFNOSUPPORT 100 | | ResourceTemporarilyUnavailable --EAGAIN 101 | | ConnectionAlreadyInProgress --EALREADY 102 | | InvalidExchange --EBADE 103 | | BadFileDescriptor --EBADF 104 | | FileDescriptorInBadState --EBADFD 105 | | BadMessage --EBADMSG 106 | | InvalidRequestDescriptor --EBADR 107 | | InvalidRequestCode --EBADRQC 108 | | InvalidSlot --EBADSLT 109 | | DeviceOrResourceBusy --EBUSY 110 | | OperationCancelled --ECANCELED 111 | | NoChildProcesses --ECHILD 112 | | ChannelNumberOutOfRange --ECHRNG 113 | | CommunicationErrorOnSend --ECOMM 114 | | ConnectionAborted --ECONNABORTED 115 | | ConnectionRefused --ECONNREFUSED 116 | | ConnectionReset --ECONNRESET 117 | | ResourceDeadlockAvoided --EDEADLK, EDEADLOCK 118 | | DestinationAddressRequired --EDESTADDRREQ 119 | | ArgumentOutOfDomain --EDOM 120 | | DiskQuotaExceeded --EDQUOT 121 | | FileExists -- EEXIST 122 | | BadAddress --EFAULT 123 | | FileTooLarge --EFBIG 124 | | HostDown --EHOSTDOWN 125 | | HostUnreachable --EHOSTUNREACH 126 | | IdentifierRemoved --EIDRM 127 | | IllegalByteSequence --EILSEQ 128 | | OperationInProgress --EINPROGRESS 129 | | InteruptedFunctionCall --EINTR 130 | | InvalidArgument --EINVAL 131 | | InputOutput --EIO 132 | | SocketConnected --EISCONN 133 | | IsADirectory --EISDIR 134 | | NamedTypeFile --EISNAM 135 | | KeyExpired --EKEYEXPIRED 136 | | KeyRejected --EKEYREJECTED 137 | | KeyRevoked --EKEYREVOKED 138 | | Level2Halted --EL2HLT 139 | | Level2NotSynchronized --EL2NSYNC 140 | | Level3Halted --EL3HLT, EL3RST 141 | | CannotAccessLibrary --ELIBACCESS 142 | | LibraryCorrupted --ELIBBAD 143 | | TooManyLibraries --ELIBMAX 144 | | LibSectionCorrupted --ELIBSCN 145 | | CannotExecuteLibrary --ELIBEXEC 146 | | TooManyLevelsOfSymbolicLinks --ELOOP 147 | | WrongMediumType --EMEDIUMTYPE 148 | | TooManyOpenFiles --EMFILE, ENFILE 149 | | TooManyLinks --EMLINK 150 | | MessageTooLong --EMSGSIZE 151 | | MultihopAttempted --EMULTIHOP 152 | | FilenameTooLong --ENAMETOOLONG 153 | | NetworkDown --ENETDOWN 154 | | ConnectionAbortedByNetwork --ENETRESET 155 | | NetworkUnreachable --ENETUNREACH 156 | | NoBufferSpaceAvailable --ENOBUFS 157 | | NoDataAvailable --ENODATA 158 | | NoDevice --ENODEV 159 | | NoSuchFileOrDirectory --ENOENT 160 | | ExecuteFormatError --ENOEXEC 161 | | RequiredKeyNotAvailable --ENOKEY 162 | | NoLocksAvailable --ENOLCK 163 | | NoLink --ENOLINK 164 | | NoMedium --ENOMEDIUM 165 | | NotEnoughSpace -- ENOMEM, ENOSPC 166 | | NoMessage --ENOMSG 167 | | NotOnNetwork --ENONET 168 | | PackageNotInstalled --ENOPKG 169 | | ProtocolNotAvailable --ENOPROTOOPT 170 | | NoStreamResources --ENOSR 171 | | NotStream --ENOSTR 172 | | FunctionNotImplemented --ENOSYS 173 | | BlockDeviceRequired --ENOTBLK 174 | | SocketNotConnected --ENOTCONN 175 | | NotADirectory --ENOTDIR 176 | | DirectoryNotEmpty --ENOTEMPTY 177 | | NotSocket --ENOTSOCKET 178 | | OperationNotSupported --ENOTSUP 179 | | InappropriateIOControlOperation --ENOTTY 180 | | NameNotUniqueOnNetwork --ENOTUNIQ 181 | | NoDeviceOrAddress --ENXIO 182 | | OperationNotSupportedOnSocket --EOPNOTSUPP 183 | | ValueTooLarge --EOVERFLOW 184 | | OperationNotPermitted -- EPERM 185 | | ProtocolFamilyNotAvailable --EPFNOSUPPORT 186 | | BrokenPipe --EPIPE 187 | | Protocol --EPROTO 188 | | ProtocolNotSupported --EPROTONOSUPPORT 189 | | WrongProtocolForSocket --EPROTOTYPE 190 | | ResultTooLarge --ERANGE 191 | | RemoteAddressChanged --EREMCHG 192 | | ObjectRemote --EREMOTE 193 | | RemoteIO --EREMOTEIO 194 | | RestartCall --ERESTART 195 | | ReadOnlyFileSystem --EROFS 196 | | TransportEndpointShutdown --ESHUTDOWN 197 | | InvalidSeek --ESPIPE 198 | | SocketNotSupported --ESOCKTNOSUPPORT 199 | | NoProcess --ESRCH 200 | | StaleFileHandle --ESTALE 201 | | StreamPipe --ESTRPIPE 202 | | TimerExpired --ETIME 203 | | ConnectionTimedOut --ETIMEOUT 204 | | TextFileBusy --ETXTBUSY 205 | | StructureNeedsCleaning --EUCLEAN 206 | | ProtocolDriverNotAttached --EUNATCH 207 | | TooManyUsers --EUSERS 208 | | OperationWouldBlock --EWOULDBLOCK 209 | | ImproperLink --EXDEV 210 | | ExchangeFull --EXFULL 211 | 212 | 213 | codeMap : List ( Code, List String ) 214 | codeMap = 215 | [ ( ArgumentListTooLong, [ "E2BIG" ] ) 216 | , ( PermissionDenied, [ "EACCES" ] ) 217 | , ( AddressInUse, [ "EADDRINUSE" ] ) 218 | , ( AddressNotAvailable, [ "EADDRNOTAVAIL" ] ) 219 | , ( AddressFamilyNotSupported, [ "EAFNOSUPPORT" ] ) 220 | , ( ResourceTemporarilyUnavailable, [ "EAGAIN" ] ) 221 | , ( ConnectionAlreadyInProgress, [ "EALREADY" ] ) 222 | , ( InvalidExchange, [ "EBADE" ] ) 223 | , ( BadFileDescriptor, [ "EBADF" ] ) 224 | , ( FileDescriptorInBadState, [ "EBADFD" ] ) 225 | , ( BadMessage, [ "EBADMSG" ] ) 226 | , ( InvalidRequestDescriptor, [ "EBADR" ] ) 227 | , ( InvalidRequestCode, [ "EBADRQC" ] ) 228 | , ( InvalidSlot, [ "EBADSLT" ] ) 229 | , ( DeviceOrResourceBusy, [ "EBUSY" ] ) 230 | , ( OperationCancelled, [ "ECANCELED" ] ) 231 | , ( NoChildProcesses, [ "ECHILD" ] ) 232 | , ( ChannelNumberOutOfRange, [ "ECHRNG" ] ) 233 | , ( CommunicationErrorOnSend, [ "ECOMM" ] ) 234 | , ( ConnectionAborted, [ "ECONNABORTED" ] ) 235 | , ( ConnectionRefused, [ "ECONNREFUSED" ] ) 236 | , ( ConnectionReset, [ "ECONNRESET" ] ) 237 | , ( ResourceDeadlockAvoided, [ "EDEADLK", "EDEADLOCK" ] ) 238 | , ( DestinationAddressRequired, [ "EDESTADDRREQ" ] ) 239 | , ( ArgumentOutOfDomain, [ "EDOM" ] ) 240 | , ( DiskQuotaExceeded, [ "EDQUOT" ] ) 241 | , ( FileExists, [ "EEXIST" ] ) 242 | , ( BadAddress, [ "EFAULT" ] ) 243 | , ( FileTooLarge, [ "EFBIG" ] ) 244 | , ( HostDown, [ "EHOSTDOWN" ] ) 245 | , ( HostUnreachable, [ "EHOSTUNREACH" ] ) 246 | , ( IdentifierRemoved, [ "EIDRM" ] ) 247 | , ( IllegalByteSequence, [ "EILSEQ" ] ) 248 | , ( OperationInProgress, [ "EINPROGRESS" ] ) 249 | , ( InteruptedFunctionCall, [ "EINTR" ] ) 250 | , ( InvalidArgument, [ "EINVAL" ] ) 251 | , ( InputOutput, [ "EIO" ] ) 252 | , ( SocketConnected, [ "EISCONN" ] ) 253 | , ( IsADirectory, [ "EISDIR" ] ) 254 | , ( NamedTypeFile, [ "EISNAM" ] ) 255 | , ( KeyExpired, [ "EKEYEXPIRED" ] ) 256 | , ( KeyRejected, [ "EKEYREJECTED" ] ) 257 | , ( KeyRevoked, [ "EKEYREVOKED" ] ) 258 | , ( Level2Halted, [ "EL2HLT" ] ) 259 | , ( Level2NotSynchronized, [ "EL2NSYNC" ] ) 260 | , ( Level3Halted, [ "EL3HLT", "EL3RST" ] ) 261 | , ( CannotAccessLibrary, [ "ELIBACCESS" ] ) 262 | , ( LibraryCorrupted, [ "ELIBBAD" ] ) 263 | , ( TooManyLibraries, [ "ELIBMAX" ] ) 264 | , ( LibSectionCorrupted, [ "ELIBSCN" ] ) 265 | , ( CannotExecuteLibrary, [ "ELIBEXEC" ] ) 266 | , ( TooManyLevelsOfSymbolicLinks, [ "ELOOP" ] ) 267 | , ( WrongMediumType, [ "EMEDIUMTYPE" ] ) 268 | , ( TooManyOpenFiles, [ "EMFILE", "ENFILE" ] ) 269 | , ( TooManyLinks, [ "EMLINK" ] ) 270 | , ( MessageTooLong, [ "EMSGSIZE" ] ) 271 | , ( MultihopAttempted, [ "EMULTIHOP" ] ) 272 | , ( FilenameTooLong, [ "ENAMETOOLONG" ] ) 273 | , ( NetworkDown, [ "ENETDOWN" ] ) 274 | , ( ConnectionAbortedByNetwork, [ "ENETRESET" ] ) 275 | , ( NetworkUnreachable, [ "ENETUNREACH" ] ) 276 | , ( NoBufferSpaceAvailable, [ "ENOBUFS" ] ) 277 | , ( NoDataAvailable, [ "ENODATA" ] ) 278 | , ( NoDevice, [ "ENODEV" ] ) 279 | , ( NoSuchFileOrDirectory, [ "ENOENT" ] ) 280 | , ( ExecuteFormatError, [ "ENOEXEC" ] ) 281 | , ( RequiredKeyNotAvailable, [ "ENOKEY" ] ) 282 | , ( NoLocksAvailable, [ "ENOLCK" ] ) 283 | , ( NoLink, [ "ENOLINK" ] ) 284 | , ( NoMedium, [ "ENOMEDIUM" ] ) 285 | , ( NotEnoughSpace, [ "ENOMEM", "ENOSPC" ] ) 286 | , ( NoMessage, [ "ENOMSG" ] ) 287 | , ( NotOnNetwork, [ "ENONET" ] ) 288 | , ( PackageNotInstalled, [ "ENOPKG" ] ) 289 | , ( ProtocolNotAvailable, [ "ENOPROTOOPT" ] ) 290 | , ( NoStreamResources, [ "ENOSR" ] ) 291 | , ( NotStream, [ "ENOSTR" ] ) 292 | , ( FunctionNotImplemented, [ "ENOSYS" ] ) 293 | , ( BlockDeviceRequired, [ "ENOTBLK" ] ) 294 | , ( SocketNotConnected, [ "ENOTCONN" ] ) 295 | , ( NotADirectory, [ "ENOTDIR" ] ) 296 | , ( DirectoryNotEmpty, [ "ENOTEMPTY" ] ) 297 | , ( NotSocket, [ "ENOTSOCKET" ] ) 298 | , ( OperationNotSupported, [ "ENOTSUP" ] ) 299 | , ( InappropriateIOControlOperation, [ "ENOTTY" ] ) 300 | , ( NameNotUniqueOnNetwork, [ "ENOTUNIQ" ] ) 301 | , ( NoDeviceOrAddress, [ "ENXIO" ] ) 302 | , ( OperationNotSupportedOnSocket, [ "EOPNOTSUPP" ] ) 303 | , ( ValueTooLarge, [ "EOVERFLOW" ] ) 304 | , ( OperationNotPermitted, [ " EPERM" ] ) 305 | , ( ProtocolFamilyNotAvailable, [ "EPFNOSUPPORT" ] ) 306 | , ( BrokenPipe, [ "EPIPE" ] ) 307 | , ( Protocol, [ "EPROTO" ] ) 308 | , ( ProtocolNotSupported, [ "EPROTONOSUPPORT" ] ) 309 | , ( WrongProtocolForSocket, [ "EPROTOTYPE" ] ) 310 | , ( ResultTooLarge, [ "ERANGE" ] ) 311 | , ( RemoteAddressChanged, [ "EREMCHG" ] ) 312 | , ( ObjectRemote, [ "EREMOTE" ] ) 313 | , ( RemoteIO, [ "EREMOTEIO" ] ) 314 | , ( RestartCall, [ "ERESTART" ] ) 315 | , ( ReadOnlyFileSystem, [ "EROFS" ] ) 316 | , ( TransportEndpointShutdown, [ "ESHUTDOWN" ] ) 317 | , ( InvalidSeek, [ "ESPIPE" ] ) 318 | , ( SocketNotSupported, [ "ESOCKTNOSUPPORT" ] ) 319 | , ( NoProcess, [ "ESRCH" ] ) 320 | , ( StaleFileHandle, [ "ESTALE" ] ) 321 | , ( StreamPipe, [ "ESTRPIPE" ] ) 322 | , ( TimerExpired, [ "ETIME" ] ) 323 | , ( ConnectionTimedOut, [ "ETIMEOUT" ] ) 324 | , ( TextFileBusy, [ "ETXTBUSY" ] ) 325 | , ( StructureNeedsCleaning, [ "EUCLEAN" ] ) 326 | , ( ProtocolDriverNotAttached, [ "EUNATCH" ] ) 327 | , ( TooManyUsers, [ "EUSERS" ] ) 328 | , ( OperationWouldBlock, [ "EWOULDBLOCK" ] ) 329 | , ( ImproperLink, [ "EXDEV" ] ) 330 | , ( ExchangeFull, [ "EXFULL" ] ) 331 | ] 332 | 333 | 334 | codeFromString : String -> Result String Code 335 | codeFromString string = 336 | List.find (Tuple.second >> List.member string) codeMap 337 | |> Maybe.map (Tuple.first >> Ok) 338 | |> Maybe.withDefault (Err <| "Unrecognized system error code: " ++ string) 339 | -------------------------------------------------------------------------------- /src/Node/FileSystem.elm: -------------------------------------------------------------------------------- 1 | module Node.FileSystem 2 | exposing 3 | ( FileType(..) 4 | , Stats 5 | , copy 6 | , defaultEncoding 7 | , defaultMode 8 | , exists 9 | , mkdirp 10 | , readFile 11 | , readFileAsString 12 | , remove 13 | , rename 14 | , statistics 15 | , symbolicLink 16 | , writeFile 17 | , writeFileFromString 18 | ) 19 | 20 | {-| FileSystem 21 | 22 | @docs defaultEncoding , defaultMode 23 | 24 | 25 | ## Query 26 | 27 | @docs Stats , FileType , exists , statistics 28 | 29 | 30 | ## Manage 31 | 32 | @docs copy , mkdirp , remove , rename , symbolicLink 33 | 34 | 35 | ## Read 36 | 37 | @docs readFile , readFileAsString 38 | 39 | 40 | ## Write 41 | 42 | @docs writeFile , writeFileFromString 43 | 44 | -} 45 | 46 | import Dict exposing (Dict) 47 | import Json.Decode as Decode 48 | import Json.Decode.Extra as Decode 49 | import List.Extra as List 50 | import Node.Buffer as Buffer exposing (Buffer) 51 | import Node.Encoding as Encoding exposing (Encoding(..)) 52 | import Node.Error as Error exposing (Error(..)) 53 | import Node.FileSystem.LowLevel as LowLevel 54 | import Node.Global exposing (intToString, stringToInt) 55 | import Node.OperatingSystem as OperatingSystem 56 | import Node.Path as Path 57 | import Result.Extra as Result 58 | import Task exposing (Task) 59 | import Time exposing (Time) 60 | 61 | 62 | {-| Default encoding (Utf8). 63 | -} 64 | defaultEncoding : Encoding 65 | defaultEncoding = 66 | Utf8 67 | 68 | 69 | type alias Mode = 70 | String 71 | 72 | 73 | {-| Default mode (Read and Write access for Owner, Group, and Others). 74 | -} 75 | defaultMode : Mode 76 | defaultMode = 77 | "666" 78 | 79 | 80 | 81 | -- QUERY 82 | 83 | 84 | {-| Path types. 85 | -} 86 | type FileType 87 | = File 88 | | Directory 89 | | Socket 90 | | SymbolicLink 91 | 92 | 93 | fileTypeFromString : String -> Result String FileType 94 | fileTypeFromString string = 95 | case string of 96 | "isDirectory" -> 97 | Ok Directory 98 | 99 | "isFile" -> 100 | Ok File 101 | 102 | "isSocket" -> 103 | Ok Socket 104 | 105 | "isSymbolicLink" -> 106 | Ok SymbolicLink 107 | 108 | _ -> 109 | Err <| "Value not recognized: " ++ string 110 | 111 | 112 | {-| Path statistics. 113 | -} 114 | type alias Stats = 115 | { type_ : FileType 116 | , size : Int 117 | , mode : Mode 118 | , accessed : Time 119 | , modified : Time 120 | , changed : Time 121 | , created : Time 122 | } 123 | 124 | 125 | statsFromValue : Decode.Value -> Result String Stats 126 | statsFromValue = 127 | Decode.decodeValue <| 128 | (Decode.succeed Stats 129 | |> Decode.andMap 130 | (Decode.map4 131 | (\isDirectory isFile isSocket isSymbolicLink -> 132 | Dict.fromList 133 | [ ( "isDirectory", isDirectory ) 134 | , ( "isFile", isFile ) 135 | , ( "isSocket", isSocket ) 136 | , ( "isSymbolicLink", isSymbolicLink ) 137 | ] 138 | |> Dict.filter (\key value -> value) 139 | |> Dict.keys 140 | ) 141 | (Decode.field "isDirectory" Decode.bool) 142 | (Decode.field "isFile" Decode.bool) 143 | (Decode.field "isSocket" Decode.bool) 144 | (Decode.field "isSymbolicLink" Decode.bool) 145 | |> Decode.andThen 146 | (\types -> 147 | if List.length types > 1 then 148 | Decode.fail "More than one type was specified." 149 | else 150 | case List.head types of 151 | Nothing -> 152 | Decode.fail "No types were specified." 153 | 154 | Just type_ -> 155 | fileTypeFromString type_ |> Result.unpack Decode.fail Decode.succeed 156 | ) 157 | ) 158 | |> Decode.andMap (Decode.field "size" Decode.int) 159 | |> Decode.andMap 160 | (Decode.field "mode" <| 161 | Decode.andThen 162 | (intToString 8 >> Result.mapError Error.message >> Decode.fromResult) 163 | Decode.int 164 | ) 165 | |> Decode.andMap (Decode.field "atimeMs" Decode.float) 166 | |> Decode.andMap (Decode.field "mtimeMs" Decode.float) 167 | |> Decode.andMap (Decode.field "ctimeMs" Decode.float) 168 | |> Decode.andMap (Decode.field "birthtimeMs" Decode.float) 169 | ) 170 | 171 | 172 | {-| Check whether a path exists. 173 | -} 174 | exists : String -> Task Error Bool 175 | exists path = 176 | LowLevel.exists path 177 | |> Task.mapError Error.fromValue 178 | 179 | 180 | {-| Get statistics for a given path. 181 | -} 182 | statistics : String -> Task Error Stats 183 | statistics path = 184 | LowLevel.stat path 185 | |> Task.mapError Error.fromValue 186 | |> Task.andThen 187 | (statsFromValue >> Result.unpack (Error "" >> Task.fail) Task.succeed) 188 | 189 | 190 | 191 | -- MANAGEMENT 192 | 193 | 194 | {-| Copy a file or directory recursively. 195 | -} 196 | copy : Bool -> String -> String -> Task Error (Dict String (Result Error ())) 197 | copy overwrite to from = 198 | let 199 | decode = 200 | Decode.decodeValue <| 201 | Decode.map2 202 | (\errors files -> 203 | List.foldl 204 | (\filename results -> 205 | let 206 | error = 207 | List.find (Error.message >> String.contains filename) errors 208 | 209 | result = 210 | error 211 | |> Maybe.map Err 212 | |> Maybe.withDefault (Ok ()) 213 | in 214 | Dict.insert filename result results 215 | ) 216 | Dict.empty 217 | files 218 | ) 219 | (Decode.field "errors" <| Decode.list Error.decoder) 220 | (Decode.field "files" <| Decode.list Decode.string) 221 | in 222 | LowLevel.copy overwrite to from 223 | |> Task.mapError Error.fromValue 224 | |> Task.andThen (decode >> Result.unpack (Error "FileSystem" >> Task.fail) Task.succeed) 225 | 226 | 227 | {-| Remove a file or directory recursively. 228 | -} 229 | remove : String -> Task Error () 230 | remove filename = 231 | LowLevel.remove filename 232 | |> Task.mapError Error.fromValue 233 | 234 | 235 | {-| Rename a file. 236 | -} 237 | rename : String -> String -> Task Error () 238 | rename from to = 239 | LowLevel.rename from to 240 | |> Task.mapError Error.fromValue 241 | 242 | 243 | type SymbolicLinkType 244 | = SymbolicLinkFile 245 | | SymbolicLinkDirectory 246 | 247 | 248 | symbolicLinkTypetoString : SymbolicLinkType -> String 249 | symbolicLinkTypetoString symbolicLinkType = 250 | case symbolicLinkType of 251 | SymbolicLinkFile -> 252 | "file" 253 | 254 | SymbolicLinkDirectory -> 255 | "dir" 256 | 257 | 258 | {-| Make a symbolic link. 259 | -} 260 | symbolicLink : String -> String -> Task Error () 261 | symbolicLink from to = 262 | let 263 | resolveWindowsSymbolicLinkType path = 264 | statistics path 265 | |> Task.andThen 266 | (\{ type_ } -> 267 | case type_ of 268 | Directory -> 269 | Task.succeed SymbolicLinkDirectory 270 | 271 | File -> 272 | Task.succeed SymbolicLinkFile 273 | 274 | _ -> 275 | Task.fail <| 276 | Error 277 | ("Symbolic link type could not be resolved: Unsupported file type: " ++ toString type_) 278 | "" 279 | ) 280 | in 281 | OperatingSystem.platform 282 | |> Result.unpack 283 | Task.fail 284 | (\platform -> 285 | case platform of 286 | OperatingSystem.Windows -> 287 | resolveWindowsSymbolicLinkType from 288 | 289 | _ -> 290 | Task.succeed SymbolicLinkFile 291 | ) 292 | |> Task.andThen 293 | (\symbolicLinkType -> 294 | LowLevel.symlink from to (symbolicLinkTypetoString symbolicLinkType) 295 | |> Task.mapError Error.fromValue 296 | ) 297 | 298 | 299 | 300 | -- READ 301 | 302 | 303 | {-| Read a file as a Buffer. 304 | -} 305 | readFile : String -> Task Error Buffer 306 | readFile filename = 307 | LowLevel.readFile filename 308 | |> Task.mapError Error.fromValue 309 | 310 | 311 | {-| Read a file as a string. 312 | -} 313 | readFileAsString : String -> Encoding -> Task Error String 314 | readFileAsString filename encoding = 315 | LowLevel.readFile filename 316 | |> Task.mapError Error.fromValue 317 | |> Task.andThen (Buffer.toString encoding >> Result.unpack Task.fail Task.succeed) 318 | 319 | 320 | 321 | -- WRITE 322 | 323 | 324 | {-| Make a directory using the given directory name. 325 | 326 | Non-existent directories in the path will be created. 327 | 328 | -} 329 | mkdirp : String -> Task Error () 330 | mkdirp dirname = 331 | LowLevel.mkdirp dirname 332 | |> Task.mapError Error.fromValue 333 | 334 | 335 | {-| Write a file from a Buffer. 336 | 337 | Non-existent directories in the filename path will be created. 338 | 339 | -} 340 | writeFile : String -> Mode -> Buffer -> Task Error () 341 | writeFile path mode buffer = 342 | stringToInt 8 mode 343 | |> Result.unpack Task.fail Task.succeed 344 | |> Task.andThen 345 | (\mode -> 346 | let 347 | dirname = 348 | Path.dirname path 349 | 350 | writeFile = 351 | LowLevel.writeFile path mode buffer 352 | |> Task.mapError Error.fromValue 353 | in 354 | Task.sequence 355 | [ mkdirp dirname 356 | , writeFile 357 | ] 358 | |> Task.map (always ()) 359 | ) 360 | 361 | 362 | {-| Write a file from a String. 363 | 364 | Non-existent directories in the file's path will be created. 365 | 366 | -} 367 | writeFileFromString : String -> Mode -> Encoding -> String -> Task Error () 368 | writeFileFromString path mode encoding data = 369 | Buffer.fromString encoding data 370 | |> Result.unpack Task.fail Task.succeed 371 | |> Task.andThen (writeFile path mode) 372 | -------------------------------------------------------------------------------- /src/Node/FileSystem/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.FileSystem.LowLevel 2 | exposing 3 | ( copy 4 | , readFile 5 | , remove 6 | , writeFile 7 | , exists 8 | , mkdirp 9 | , rename 10 | , stat 11 | , symlink 12 | ) 13 | 14 | import Node.Buffer exposing (Buffer) 15 | import Json.Decode as Decode 16 | import Task exposing (Task) 17 | import Native.FileSystem 18 | 19 | 20 | {-| Returns with 21 | 22 | Fail: 23 | Error 24 | 25 | Succeed: 26 | { errors: List Error, files : List String } 27 | errors = array of errors for files that failed 28 | "File " 29 | files = list of destination directories and files that copy was attempted on 30 | "" 31 | 32 | Error is standard Error with list of errors for each error incurred 33 | { message, stack, list (Error {message, stack })} 34 | 35 | in single file mode we have different behavior ... 36 | Error is just the problem for a single file 37 | filename is undefined 38 | 39 | in cofirm case, error = list of stat errors 40 | 41 | -} 42 | copy : Bool -> String -> String -> Task Decode.Value Decode.Value 43 | copy = 44 | Native.FileSystem.copy 45 | 46 | 47 | exists : String -> Task Decode.Value Bool 48 | exists = 49 | Native.FileSystem.exists 50 | 51 | 52 | mkdirp : String -> Task Decode.Value () 53 | mkdirp = 54 | Native.FileSystem.mkdirp 55 | 56 | 57 | readFile : String -> Task Decode.Value Buffer 58 | readFile = 59 | Native.FileSystem.readFile 60 | 61 | 62 | remove : String -> Task Decode.Value () 63 | remove = 64 | Native.FileSystem.remove 65 | 66 | 67 | rename : String -> String -> Task Decode.Value () 68 | rename = 69 | Native.FileSystem.rename 70 | 71 | 72 | stat : String -> Task Decode.Value Decode.Value 73 | stat = 74 | Native.FileSystem.stat 75 | 76 | 77 | symlink : String -> String -> String -> Task Decode.Value () 78 | symlink = 79 | Native.FileSystem.symlink 80 | 81 | 82 | writeFile : String -> Int -> Buffer -> Task Decode.Value () 83 | writeFile = 84 | Native.FileSystem.writeFile 85 | -------------------------------------------------------------------------------- /src/Node/Global.elm: -------------------------------------------------------------------------------- 1 | module Node.Global 2 | exposing 3 | ( intToString 4 | , stringToInt 5 | ) 6 | 7 | {-| Global functions 8 | 9 | @docs intToString , stringToInt 10 | 11 | -} 12 | 13 | import Node.Global.LowLevel as LowLevel 14 | import Node.Error as Error exposing (Error) 15 | 16 | 17 | {-| Convert a string into an integer using the specified radix. 18 | -} 19 | stringToInt : Int -> String -> Result Error Int 20 | stringToInt radix string = 21 | LowLevel.parseInt radix string 22 | |> Result.mapError Error.fromValue 23 | 24 | 25 | {-| Convert an integer into a string using the specified radix. 26 | -} 27 | intToString : Int -> Int -> Result Error String 28 | intToString radix integer = 29 | LowLevel.toString radix integer 30 | |> Result.mapError Error.fromValue 31 | -------------------------------------------------------------------------------- /src/Node/Global/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.Global.LowLevel 2 | exposing 3 | ( parseInt 4 | , toString 5 | ) 6 | 7 | import Json.Decode as Decode 8 | import Native.Global 9 | 10 | 11 | parseInt : Int -> String -> Result Decode.Value Int 12 | parseInt = 13 | Native.Global.parseInt 14 | 15 | 16 | toString : Int -> Int -> Result Decode.Value String 17 | toString = 18 | Native.Global.toString 19 | -------------------------------------------------------------------------------- /src/Node/OperatingSystem.elm: -------------------------------------------------------------------------------- 1 | module Node.OperatingSystem 2 | exposing 3 | ( Platform(..) 4 | , homeDirectory 5 | , platform 6 | , tempDirectory 7 | ) 8 | 9 | {-| Operating system information. 10 | 11 | @docs Platform , homeDirectory , platform , tempDirectory 12 | 13 | -} 14 | 15 | import Node.Error as Error exposing (Error(..)) 16 | import Node.OperatingSystem.LowLevel as LowLevel 17 | 18 | 19 | {-| Current user's home directory. 20 | -} 21 | homeDirectory : String 22 | homeDirectory = 23 | LowLevel.homedir 24 | 25 | 26 | {-| Platforms supported by Node.js. 27 | -} 28 | type Platform 29 | = Aix 30 | | Android 31 | | Darwin 32 | | FreeBsd 33 | | Linux 34 | | OpenBsd 35 | | SunOs 36 | | Windows 37 | 38 | 39 | stringToPlatform : String -> Result String Platform 40 | stringToPlatform string = 41 | case string of 42 | "aix" -> 43 | Ok Aix 44 | 45 | "android" -> 46 | Ok Android 47 | 48 | "darwin" -> 49 | Ok Darwin 50 | 51 | "freebsd" -> 52 | Ok FreeBsd 53 | 54 | "linux" -> 55 | Ok Linux 56 | 57 | "openbsd" -> 58 | Ok OpenBsd 59 | 60 | "sunos" -> 61 | Ok SunOs 62 | 63 | "win32" -> 64 | Ok Windows 65 | 66 | _ -> 67 | Err <| "Unrecognized platform: " ++ string 68 | 69 | 70 | {-| Platform set at compile time of current running version of Node.js. 71 | -} 72 | platform : Result Error Platform 73 | platform = 74 | LowLevel.platform 75 | |> stringToPlatform 76 | |> Result.mapError (\message -> Error message "") 77 | 78 | 79 | {-| Current user's temporary directory. 80 | -} 81 | tempDirectory : String 82 | tempDirectory = 83 | LowLevel.tmpdir 84 | -------------------------------------------------------------------------------- /src/Node/OperatingSystem/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.OperatingSystem.LowLevel 2 | exposing 3 | ( homedir 4 | , platform 5 | , tmpdir 6 | ) 7 | 8 | import Json.Decode as Decode 9 | import Native.OperatingSystem 10 | 11 | 12 | homedir : String 13 | homedir = 14 | Native.OperatingSystem.homedir 15 | 16 | 17 | platform : String 18 | platform = 19 | Native.OperatingSystem.platform 20 | 21 | 22 | tmpdir : String 23 | tmpdir = 24 | Native.OperatingSystem.tmpdir 25 | -------------------------------------------------------------------------------- /src/Node/Path.elm: -------------------------------------------------------------------------------- 1 | module Node.Path 2 | exposing 3 | ( basename 4 | , delimiter 5 | , dirname 6 | , extname 7 | , join 8 | , separator 9 | ) 10 | 11 | {-| Path 12 | 13 | @docs basename , delimiter , dirname , extname , join , separator 14 | 15 | -} 16 | 17 | import Native.Path 18 | 19 | 20 | {-| Extract the basename from a filename. 21 | -} 22 | basename : String -> String 23 | basename = 24 | Native.Path.basename 25 | 26 | 27 | {-| The platform-specific path delimiter. 28 | -} 29 | delimiter : String 30 | delimiter = 31 | Native.Path.delimiter 32 | 33 | 34 | {-| Extract the directory name from a filename. 35 | -} 36 | dirname : String -> String 37 | dirname = 38 | Native.Path.dirname 39 | 40 | 41 | {-| Extract the extension name from a filename. 42 | -} 43 | extname : String -> String 44 | extname = 45 | Native.Path.extname 46 | 47 | 48 | {-| Build a path from the list of supplied strings 49 | -} 50 | join : List String -> String 51 | join = 52 | Native.Path.join 53 | 54 | 55 | {-| The platform-specific path segment separator. 56 | -} 57 | separator : String 58 | separator = 59 | Native.Path.sep 60 | -------------------------------------------------------------------------------- /src/Node/Process.elm: -------------------------------------------------------------------------------- 1 | module Node.Process 2 | exposing 3 | ( cwd 4 | , environment 5 | ) 6 | 7 | {-| Process 8 | 9 | @docs cwd , environment 10 | 11 | -} 12 | 13 | import Dict exposing (Dict) 14 | import Json.Decode as Decode 15 | import Node.Error as Error exposing (Error(..)) 16 | import Node.Process.LowLevel as LowLevel 17 | import Task exposing (Task) 18 | 19 | 20 | {-| Current working directory. 21 | -} 22 | cwd : () -> Task Error String 23 | cwd t0 = 24 | LowLevel.cwd t0 25 | |> Task.mapError Error.fromValue 26 | 27 | 28 | {-| Environment variables. 29 | -} 30 | environment : Result String (Dict String String) 31 | environment = 32 | Decode.decodeValue (Decode.dict Decode.string) LowLevel.env 33 | -------------------------------------------------------------------------------- /src/Node/Process/LowLevel.elm: -------------------------------------------------------------------------------- 1 | module Node.Process.LowLevel 2 | exposing 3 | ( cwd 4 | , env 5 | ) 6 | 7 | import Native.Process 8 | import Json.Decode as Decode 9 | import Task exposing (Task) 10 | 11 | 12 | env : Decode.Value 13 | env = 14 | Native.Process.env 15 | 16 | 17 | cwd : () -> Task Decode.Value String 18 | cwd = 19 | Native.Process.cwd 20 | -------------------------------------------------------------------------------- /test/Buffer/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Buffer as Buffer exposing (Buffer) 4 | import Node.Encoding as Encoding 5 | import Node.Error as Error 6 | import Result.Extra as Result 7 | import Task exposing (Task) 8 | 9 | 10 | type Msg 11 | = TestComplete (Result Error.Error ()) 12 | 13 | 14 | type alias Model = 15 | {} 16 | 17 | 18 | model : Model 19 | model = 20 | {} 21 | 22 | 23 | init : ( Model, Cmd Msg ) 24 | init = 25 | let 26 | string = 27 | "hello" 28 | 29 | encoding = 30 | Encoding.Utf8 31 | in 32 | model 33 | ! [ Ok () 34 | |> Result.andThen 35 | (\_ -> 36 | let 37 | message = 38 | Debug.log "Testing" "Buffer.fromString" 39 | in 40 | Buffer.fromString Encoding.Utf8 string 41 | ) 42 | |> Result.andThen 43 | (\buffer -> 44 | let 45 | message = 46 | Debug.log "Testing" "Buffer.toString" 47 | in 48 | Buffer.toString Encoding.Utf8 buffer 49 | ) 50 | |> Result.andThen 51 | (\bufferString -> 52 | if bufferString /= string then 53 | Err <| Error.Error ("Buffer.toString failed: " ++ bufferString) "" 54 | else 55 | Ok () 56 | ) 57 | |> Result.unpack Task.fail Task.succeed 58 | |> Task.attempt TestComplete 59 | ] 60 | 61 | 62 | update : Msg -> Model -> ( Model, Cmd Msg ) 63 | update msg model = 64 | case msg of 65 | TestComplete result -> 66 | let 67 | message = 68 | Debug.log "TestComplete" result 69 | in 70 | model ! [] 71 | 72 | 73 | 74 | -- MAIN 75 | 76 | 77 | main : Program Never Model Msg 78 | main = 79 | Platform.program 80 | { init = init 81 | , update = update 82 | , subscriptions = always Sub.none 83 | } 84 | -------------------------------------------------------------------------------- /test/Buffer/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/ChildProcess/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Error as Error 4 | import Node.ChildProcess as ChildProcess 5 | import Task exposing (Task) 6 | 7 | 8 | type Msg 9 | = TestComplete (Result Error.Error ()) 10 | 11 | 12 | type alias Model = 13 | {} 14 | 15 | 16 | model : Model 17 | model = 18 | {} 19 | 20 | 21 | init : ( Model, Cmd Msg ) 22 | init = 23 | model 24 | ! [ Task.succeed () 25 | |> Task.andThen 26 | (\_ -> 27 | let 28 | message = 29 | Debug.log "Testing" "spawn" 30 | in 31 | ChildProcess.spawn "ls -al" ChildProcess.Verbose 32 | |> Task.andThen 33 | (\exit -> 34 | let 35 | message = 36 | Debug.log "Complete" "spawn" 37 | in 38 | Task.succeed () 39 | ) 40 | ) 41 | |> Task.attempt TestComplete 42 | ] 43 | 44 | 45 | update : Msg -> Model -> ( Model, Cmd Msg ) 46 | update msg model = 47 | case msg of 48 | TestComplete result -> 49 | let 50 | message = 51 | Debug.log "TestComplete" result 52 | in 53 | model ! [] 54 | 55 | 56 | 57 | -- MAIN 58 | 59 | 60 | main : Program Never Model Msg 61 | main = 62 | Platform.program 63 | { init = init 64 | , update = update 65 | , subscriptions = always Sub.none 66 | } 67 | -------------------------------------------------------------------------------- /test/ChildProcess/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/Crypto/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Buffer as Buffer exposing (Buffer) 4 | import Node.Encoding as Encoding 5 | import Node.Error as Error exposing (Error(..)) 6 | import Node.Crypto as Crypto 7 | import Result.Extra as Result 8 | import Task exposing (Task) 9 | 10 | 11 | type Msg 12 | = TestComplete (Result Error ()) 13 | 14 | 15 | type alias Model = 16 | {} 17 | 18 | 19 | model : Model 20 | model = 21 | {} 22 | 23 | 24 | init : ( Model, Cmd Msg ) 25 | init = 26 | let 27 | cipher = 28 | Crypto.Aes128 29 | 30 | password = 31 | "test" 32 | 33 | string = 34 | "hello" 35 | 36 | encoding = 37 | Encoding.Utf8 38 | 39 | buffer = 40 | Buffer.fromString encoding string 41 | in 42 | case buffer of 43 | Err error -> 44 | Debug.crash (toString error) 45 | 46 | Ok buffer -> 47 | model 48 | ! [ Ok () 49 | |> Result.andThen 50 | (\_ -> 51 | let 52 | message = 53 | Debug.log "Testing" "Crypto.encrypt" 54 | in 55 | Crypto.encrypt cipher password buffer 56 | |> Result.andThen 57 | (\buffer -> 58 | let 59 | encryptedString = 60 | Buffer.toString encoding buffer 61 | |> Result.withDefault "" 62 | in 63 | if encryptedString == string then 64 | Err <| Error ("Encryption failed: " ++ encryptedString) "" 65 | else 66 | Ok buffer 67 | ) 68 | ) 69 | |> Result.andThen 70 | (\buffer -> 71 | let 72 | message = 73 | Debug.log "Testing" "Crypto.decrypt" 74 | in 75 | Crypto.decrypt cipher password buffer 76 | |> Result.andThen 77 | (\buffer -> 78 | let 79 | decryptedString = 80 | Buffer.toString encoding buffer 81 | |> Result.withDefault "" 82 | in 83 | if decryptedString /= string then 84 | Err <| Error ("Decryption failed: " ++ decryptedString) "" 85 | else 86 | Ok () 87 | ) 88 | ) 89 | |> Result.unpack Task.fail Task.succeed 90 | |> Task.andThen 91 | (\_ -> 92 | let 93 | message = 94 | Debug.log "Testing" "randomBytes" 95 | in 96 | Crypto.randomBytes 4 97 | |> Task.map (always ()) 98 | ) 99 | |> Task.attempt TestComplete 100 | ] 101 | 102 | 103 | update : Msg -> Model -> ( Model, Cmd Msg ) 104 | update msg model = 105 | case msg of 106 | TestComplete result -> 107 | let 108 | message = 109 | Debug.log "TestComplete" result 110 | in 111 | model ! [] 112 | 113 | 114 | 115 | -- MAIN 116 | 117 | 118 | main : Program Never Model Msg 119 | main = 120 | Platform.program 121 | { init = init 122 | , update = update 123 | , subscriptions = always Sub.none 124 | } 125 | -------------------------------------------------------------------------------- /test/Crypto/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/FileSystem/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Buffer as Buffer 4 | import Node.Error as Common exposing (Error(..)) 5 | import Node.Encoding as Encoding 6 | import Node.FileSystem as FileSystem 7 | import Result.Extra as Result 8 | import Task exposing (Task) 9 | import Utils.Ops exposing (..) 10 | 11 | 12 | type Msg 13 | = TestComplete (Result Error ()) 14 | 15 | 16 | type alias Model = 17 | {} 18 | 19 | 20 | model : Model 21 | model = 22 | {} 23 | 24 | 25 | init : ( Model, Cmd Msg ) 26 | init = 27 | let 28 | filename = 29 | "output.txt" 30 | 31 | testRoot = 32 | "test/FileSystem/tmp/" 33 | 34 | filenamePath = 35 | testRoot ++ filename 36 | 37 | symLink = 38 | "link" 39 | 40 | symlinkPath = 41 | symLink 42 | 43 | data = 44 | "data" 45 | 46 | encoding = 47 | Encoding.Utf8 48 | 49 | buffer = 50 | Buffer.fromString encoding data 51 | |> Result.extract (\_ -> Debug.crash "Failed to create buffer") 52 | 53 | testing = 54 | Debug.log "Testing" 55 | 56 | completed msg = 57 | Debug.log "\x1B[32mCompleted" (msg ++ "\x1B[0m") 58 | 59 | completedTask msg = 60 | Task.map (always (completed msg) >> always ()) 61 | 62 | failedTask = 63 | Task.fail << Error "Failed" 64 | in 65 | model 66 | ! [ Task.succeed () 67 | |> Task.andThen 68 | (\_ -> 69 | testing "mkdirp" 70 | |> (\_ -> FileSystem.mkdirp "test/test1/test2") 71 | |> completedTask "mkdirp" 72 | ) 73 | |> Task.andThen 74 | (\_ -> 75 | testing "remove directory" 76 | |> (\_ -> FileSystem.remove "test/test1") 77 | |> completedTask "remove directory" 78 | ) 79 | |> Task.andThen 80 | (\_ -> 81 | testing "writeFile" 82 | |> (\_ -> FileSystem.writeFile filenamePath FileSystem.defaultMode buffer) 83 | |> completedTask "writeFile" 84 | ) 85 | |> Task.andThen 86 | (\_ -> 87 | testing "rename" 88 | |> (\_ -> 89 | FileSystem.rename filenamePath (filenamePath ++ "r") 90 | |> Task.andThen (\_ -> FileSystem.rename (filenamePath ++ "r") filenamePath) 91 | ) 92 | |> completedTask "rename" 93 | ) 94 | |> Task.andThen 95 | (\_ -> 96 | testing "symbolicLink" 97 | |> (\_ -> FileSystem.symbolicLink filenamePath symlinkPath) 98 | |> completedTask "symbolicLink" 99 | ) 100 | |> Task.andThen 101 | (\_ -> 102 | testing "statistics" 103 | |> (\_ -> FileSystem.statistics symlinkPath) 104 | |> Task.andThen 105 | (\stats -> 106 | case stats.type_ of 107 | FileSystem.SymbolicLink -> 108 | Task.succeed () 109 | 110 | _ -> 111 | failedTask (symlinkPath ++ " is NOT a symbolic link") 112 | ) 113 | |> completedTask "statistics" 114 | ) 115 | |> Task.andThen 116 | (\_ -> 117 | testing "exists" 118 | |> (\_ -> FileSystem.exists symlinkPath) 119 | |> Task.andThen 120 | (flip (?) 121 | ( Task.succeed () 122 | , failedTask (symlinkPath ++ " doesn't exist") 123 | ) 124 | ) 125 | |> completedTask "exists" 126 | ) 127 | |> Task.andThen 128 | (\_ -> 129 | testing "remove symlink" 130 | |> (\_ -> FileSystem.remove symlinkPath) 131 | |> completedTask "remove symlink" 132 | ) 133 | |> Task.andThen 134 | (\_ -> 135 | testing "readFile" 136 | |> (\_ -> FileSystem.readFile filenamePath) 137 | |> Task.andThen 138 | (\buffer -> 139 | Buffer.toString encoding buffer 140 | |> Result.extract (\_ -> Debug.crash "Failed to create string") 141 | |> (\string -> 142 | (string == data) 143 | ? ( Task.succeed () 144 | |> completedTask "readFile" 145 | , failedTask "readFile" 146 | ) 147 | ) 148 | ) 149 | ) 150 | |> Task.andThen 151 | (\string -> 152 | testing "writeFileFromString" 153 | |> (\_ -> FileSystem.writeFileFromString filenamePath "666" encoding "writeFileFromString") 154 | |> completedTask "writeFileFromString" 155 | ) 156 | |> Task.andThen 157 | (\_ -> 158 | testing "readFileAsString" 159 | |> (\_ -> FileSystem.readFileAsString filenamePath encoding) 160 | |> Task.andThen 161 | (\string -> 162 | (string == "writeFileFromString") 163 | ? ( Task.succeed () 164 | |> completedTask "readFileAsString" 165 | , failedTask "readFile" 166 | ) 167 | ) 168 | ) 169 | |> Task.andThen 170 | (\_ -> 171 | testing "copy" 172 | |> (\_ -> FileSystem.copy False (filenamePath ++ "c") filenamePath) 173 | |> completedTask "copy" 174 | ) 175 | |> Task.andThen 176 | (\_ -> 177 | testing "remove" 178 | |> (\_ -> FileSystem.remove testRoot) 179 | |> completedTask "remove" 180 | ) 181 | |> Task.attempt TestComplete 182 | ] 183 | 184 | 185 | update : Msg -> Model -> ( Model, Cmd Msg ) 186 | update msg model = 187 | case msg of 188 | TestComplete (Err nodeError) -> 189 | case nodeError of 190 | Error _ error -> 191 | Debug.log "Test Failed" ("\x1B[31m" ++ error ++ "\x1B[0m") 192 | |> always (model ! []) 193 | 194 | SystemError _ _ -> 195 | Debug.crash "Bug" 196 | 197 | TestComplete (Ok ()) -> 198 | Debug.log ("\n\x1B[32m" ++ "ALL Tests Passed" ++ "\x1B[0m") "" 199 | |> always (model ! []) 200 | 201 | 202 | 203 | -- MAIN 204 | 205 | 206 | main : Program Never Model Msg 207 | main = 208 | Platform.program 209 | { init = init 210 | , update = update 211 | , subscriptions = always Sub.none 212 | } 213 | -------------------------------------------------------------------------------- /test/FileSystem/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/Global/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Global as Global 4 | import Node.Error as Error 5 | import Result.Extra as Result 6 | import Task exposing (Task) 7 | 8 | 9 | type Msg 10 | = TestComplete (Result Error.Error ()) 11 | 12 | 13 | type alias Model = 14 | {} 15 | 16 | 17 | model : Model 18 | model = 19 | {} 20 | 21 | 22 | init : ( Model, Cmd Msg ) 23 | init = 24 | let 25 | string = 26 | "4033903d" 27 | in 28 | model 29 | ! [ Ok () 30 | |> Result.andThen 31 | (\_ -> 32 | let 33 | message = 34 | Debug.log "Testing" "stringToInt" 35 | in 36 | Global.stringToInt 16 string 37 | |> Result.andThen 38 | (\value -> 39 | if value == 1077121085 then 40 | let 41 | message = 42 | Debug.log "Complete" "stringToInt" 43 | in 44 | Ok () 45 | else 46 | Err <| Error.Error "Failed" "Wrong value." 47 | ) 48 | ) 49 | |> Result.andThen 50 | (\_ -> 51 | let 52 | message = 53 | Debug.log "Testing" "intToString" 54 | in 55 | Global.intToString 16 1077121085 56 | |> Result.andThen 57 | (\value -> 58 | if value == "4033903d" then 59 | let 60 | message = 61 | Debug.log "Complete" "intToString" 62 | in 63 | Ok () 64 | else 65 | Err <| Error.Error "Failed" "Wrong value." 66 | ) 67 | ) 68 | |> Result.unpack Task.fail Task.succeed 69 | |> Task.attempt TestComplete 70 | ] 71 | 72 | 73 | update : Msg -> Model -> ( Model, Cmd Msg ) 74 | update msg model = 75 | case msg of 76 | TestComplete result -> 77 | let 78 | message = 79 | Debug.log "TestComplete" result 80 | in 81 | model ! [] 82 | 83 | 84 | 85 | -- MAIN 86 | 87 | 88 | main : Program Never Model Msg 89 | main = 90 | Platform.program 91 | { init = init 92 | , update = update 93 | , subscriptions = always Sub.none 94 | } 95 | -------------------------------------------------------------------------------- /test/Global/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/OperatingSystem/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Error as Error 4 | import Node.OperatingSystem as OperatingSystem 5 | import Result.Extra as Result 6 | import Task exposing (Task) 7 | 8 | 9 | type Msg 10 | = TestComplete (Result Error.Error ()) 11 | 12 | 13 | type alias Model = 14 | {} 15 | 16 | 17 | model : Model 18 | model = 19 | {} 20 | 21 | 22 | init : ( Model, Cmd Msg ) 23 | init = 24 | model 25 | ! [ Ok () 26 | |> Result.andThen 27 | (\_ -> 28 | let 29 | message = 30 | Debug.log "Testing" "homeDirectory" 31 | in 32 | let 33 | value = 34 | OperatingSystem.homeDirectory 35 | in 36 | if String.length value > 0 then 37 | let 38 | message = 39 | Debug.log "Complete" "homeDirectory" 40 | in 41 | Ok () 42 | else 43 | Err <| Error.Error "Failed: 0 length" "" 44 | ) 45 | |> Result.andThen 46 | (\_ -> 47 | let 48 | message = 49 | Debug.log "Testing" "platform" 50 | in 51 | case OperatingSystem.platform of 52 | Ok _ -> 53 | let 54 | message = 55 | Debug.log "Complete" "platform" 56 | in 57 | Ok () 58 | 59 | Err error -> 60 | Err error 61 | ) 62 | |> Result.andThen 63 | (\_ -> 64 | let 65 | message = 66 | Debug.log "Testing" "tempDirectory" 67 | in 68 | let 69 | value = 70 | OperatingSystem.tempDirectory 71 | in 72 | if String.length value > 0 then 73 | let 74 | message = 75 | Debug.log "Complete" "tempDirectory" 76 | in 77 | Ok () 78 | else 79 | Err <| Error.Error "Failed: 0 length" "" 80 | ) 81 | |> Result.unpack Task.fail Task.succeed 82 | |> Task.attempt TestComplete 83 | ] 84 | 85 | 86 | update : Msg -> Model -> ( Model, Cmd Msg ) 87 | update msg model = 88 | case msg of 89 | TestComplete result -> 90 | let 91 | message = 92 | Debug.log "TestComplete" result 93 | in 94 | model ! [] 95 | 96 | 97 | 98 | -- MAIN 99 | 100 | 101 | main : Program Never Model Msg 102 | main = 103 | Platform.program 104 | { init = init 105 | , update = update 106 | , subscriptions = always Sub.none 107 | } 108 | -------------------------------------------------------------------------------- /test/OperatingSystem/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/Path/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Node.Error as Error 4 | import Node.Path as Path 5 | import Result.Extra as Result 6 | import Task exposing (Task) 7 | 8 | 9 | type Msg 10 | = TestComplete (Result Error.Error ()) 11 | 12 | 13 | type alias Model = 14 | {} 15 | 16 | 17 | model : Model 18 | model = 19 | {} 20 | 21 | 22 | init : ( Model, Cmd Msg ) 23 | init = 24 | let 25 | path = 26 | "/test/directory/file.txt" 27 | in 28 | model 29 | ! [ Ok () 30 | |> Result.andThen 31 | (\_ -> 32 | let 33 | message = 34 | Debug.log "Testing" "basename" 35 | 36 | value = 37 | Path.basename path 38 | in 39 | if value == "file.txt" then 40 | let 41 | message = 42 | Debug.log "Complete" "basename" 43 | in 44 | Ok () 45 | else 46 | Err <| Error.Error "Failed" value 47 | ) 48 | |> Result.andThen 49 | (\_ -> 50 | let 51 | message = 52 | Debug.log "Testing" "delimiter" 53 | 54 | value = 55 | Path.delimiter 56 | in 57 | if value == ":" || value == ";" then 58 | let 59 | message = 60 | Debug.log "Complete" "delimiter" 61 | in 62 | Ok () 63 | else 64 | Err <| Error.Error "Failed" value 65 | ) 66 | |> Result.andThen 67 | (\_ -> 68 | let 69 | message = 70 | Debug.log "Testing" "dirname" 71 | 72 | value = 73 | Path.dirname path 74 | in 75 | if value == "/test/directory" then 76 | let 77 | message = 78 | Debug.log "Complete" "dirname" 79 | in 80 | Ok () 81 | else 82 | Err <| Error.Error "Failed" value 83 | ) 84 | |> Result.andThen 85 | (\_ -> 86 | let 87 | message = 88 | Debug.log "Testing" "extname" 89 | 90 | value = 91 | Path.extname path 92 | in 93 | if value == ".txt" then 94 | let 95 | message = 96 | Debug.log "Complete" "extname" 97 | in 98 | Ok () 99 | else 100 | Err <| Error.Error "Failed" value 101 | ) 102 | |> Result.andThen 103 | (\_ -> 104 | let 105 | message = 106 | Debug.log "Testing" "join" 107 | 108 | value = 109 | Path.join [ "/test", "directory", "file.txt" ] 110 | in 111 | if value == path then 112 | let 113 | message = 114 | Debug.log "Complete" "join" 115 | in 116 | Ok () 117 | else 118 | Err <| Error.Error "Failed" value 119 | ) 120 | |> Result.andThen 121 | (\_ -> 122 | let 123 | message = 124 | Debug.log "Testing" "separator" 125 | 126 | value = 127 | Path.separator 128 | in 129 | if value == "/" || value == "\\" then 130 | let 131 | message = 132 | Debug.log "Complete" "separator" 133 | in 134 | Ok () 135 | else 136 | Err <| Error.Error "Failed" value 137 | ) 138 | |> Result.unpack Task.fail Task.succeed 139 | |> Task.attempt TestComplete 140 | ] 141 | 142 | 143 | update : Msg -> Model -> ( Model, Cmd Msg ) 144 | update msg model = 145 | case msg of 146 | TestComplete result -> 147 | let 148 | message = 149 | Debug.log "TestComplete" result 150 | in 151 | model ! [] 152 | 153 | 154 | 155 | -- MAIN 156 | 157 | 158 | main : Program Never Model Msg 159 | main = 160 | Platform.program 161 | { init = init 162 | , update = update 163 | , subscriptions = always Sub.none 164 | } 165 | -------------------------------------------------------------------------------- /test/Path/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | -------------------------------------------------------------------------------- /test/Process/Main.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (main) 2 | 3 | import Dict 4 | import Node.Error as Error 5 | import Node.Process as Process 6 | import Task exposing (Task) 7 | 8 | 9 | type Msg 10 | = TestComplete (Result Error.Error ()) 11 | 12 | 13 | type alias Model = 14 | {} 15 | 16 | 17 | model : Model 18 | model = 19 | {} 20 | 21 | 22 | init : ( Model, Cmd Msg ) 23 | init = 24 | model 25 | ! [ Task.succeed () 26 | |> Task.andThen 27 | (\_ -> 28 | let 29 | message = 30 | Debug.log "Testing" "cwd" 31 | in 32 | Process.cwd () 33 | |> Task.andThen 34 | (\dirname -> 35 | let 36 | message = 37 | Debug.log "Complete" "cwd" 38 | in 39 | Task.succeed () 40 | ) 41 | ) 42 | |> Task.andThen 43 | (\_ -> 44 | let 45 | message = 46 | Debug.log "Testing" "environment" 47 | 48 | value = 49 | Process.environment 50 | in 51 | case value of 52 | Ok value -> 53 | if Dict.isEmpty value then 54 | Task.fail <| Error.Error "Failed" (toString value) 55 | else 56 | let 57 | message = 58 | Debug.log "Complete" "environment" 59 | in 60 | Task.succeed () 61 | 62 | Err error -> 63 | Task.fail <| Error.Error "Failed" (toString value) 64 | ) 65 | |> Task.attempt TestComplete 66 | ] 67 | 68 | 69 | update : Msg -> Model -> ( Model, Cmd Msg ) 70 | update msg model = 71 | case msg of 72 | TestComplete result -> 73 | let 74 | message = 75 | Debug.log "TestComplete" result 76 | in 77 | model ! [] 78 | 79 | 80 | 81 | -- MAIN 82 | 83 | 84 | main : Program Never Model Msg 85 | main = 86 | Platform.program 87 | { init = init 88 | , update = update 89 | , subscriptions = always Sub.none 90 | } 91 | -------------------------------------------------------------------------------- /test/Process/index.js: -------------------------------------------------------------------------------- 1 | const App = require("./main.js") 2 | const app = App.Main.worker() 3 | --------------------------------------------------------------------------------