Skip to main content
Deno 2 is finally here 🎉️
Learn more
import * as macromaniaAssets from "https://deno.land/x/macromania_assets@v0.2.0/deps.ts";

Namespaces

Utilities for working with OS-specific file paths.

Utilities for working with OS-specific file paths.

Classes

The state that is threaded through an evaluation process.

Functions

Create an absolute path in the OutFs.

Change the current out directory for the children of this macro.

Changes the permission of a specific file/directory of specified path. Ignores the process's umask.

Changes the permission of a specific file/directory of specified path. Ignores the process's umask.

Changes the owner of a regular file or directory.

Changes the owner of a regular file or directory.

Clone an OutFsPath into a completely separate object.

Copies a file or directory. The directory can have contents. Like cp -r.

Copies a file or directory. The directory can have contents. Like cp -r.

Copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable.

Copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable.

Create a new logger. It can be configured independently from all other loggers.

Create a getter and a setter for a unique, statically typed portion of the State of a Context.

Return true if at least one warning or error was logged by any logger.

Create a directory in the current out directory, and cd there.

Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.

Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.

Ensures that the directory exists. If the directory structure does not exist, it is created. Like mkdir -p.

Ensures that the directory exists. If the directory structure does not exist, it is created. Like mkdir -p.

Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is NOT MODIFIED.

Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is NOT MODIFIED.

Ensures that the hard link exists. If the directory structure does not exist, it is created.

Ensures that the hard link exists. If the directory structure does not exist, it is created.

Ensures that the file does not exist.

Ensures that the file does not exist.

Ensures that the symlink exists. If the directory structure does not exist, it is created.

Ensures that the symlink exists. If the directory structure does not exist, it is created.

Take the output of a jsx transform and turn it into an array of Expressions.

Create a file in current out directory, write the evaluated children there.

Creates newpath as a hard link to oldpath.

Creates newpath as a hard link to oldpath.

Creates a new temporary directory in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the directory name with prefix and suffix respectively.

Creates a new temporary directory in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the directory name with prefix and suffix respectively.

Creates a new temporary file in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the file name with prefix and suffix respectively.

Creates a new temporary file in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the file name with prefix and suffix respectively.

Creates a new directory with the specified path.

Creates a new directory with the specified path.

Get the current out directory as an OutFsPath.

Get the name of the current file, or null if called outside of any File macro invocation.

Get the mount point of the OutFs as a platform-dependent absolute path.

Return the last portion of a path. Trailing directory separators are ignored, and optional suffix is removed.

Determines the common path from a set of paths, using an optional separator, which defaults to the OS default separator.

Return the directory path of a path.

Return the extension of the path with leading period.

Generate a path from FormatInputPathObject object.

Converts a file URL to a path string.

Convert a glob string to a regular expression.

Verifies whether provided path is absolute

Test whether the given string is a glob

Join all given a sequence of paths,then normalizes the resulting path.

Like join(), but doesn't collapse "**/.." when globstar is true.

Normalize the path, resolving '..' and '.' segments. Note that resolving these segments does not necessarily mean that all will be eliminated. A '..' at the top-level will be preserved, and an empty path is canonically '.'.

Like normalize(), but doesn't collapse "**/.." when globstar is true.

Return a ParsedPath object of the path.

Return the relative path from from to to based on current working directory.

Resolves path segments into a path

Converts a path string to a file URL.

Resolves path to a namespace path

Return the last portion of a path. Trailing directory separators are ignored, and optional suffix is removed.

Determines the common path from a set of paths, using an optional separator, which defaults to the OS default separator.

Return the directory path of a path.

Return the extension of the path with leading period.

Generate a path from FormatInputPathObject object.

Converts a file URL to a path string.

Convert a glob string to a regular expression.

Verifies whether provided path is absolute

Test whether the given string is a glob

Join all given a sequence of paths,then normalizes the resulting path.

Like join(), but doesn't collapse "**/.." when globstar is true.

Normalize the path, resolving '..' and '.' segments. Note that resolving these segments does not necessarily mean that all will be eliminated. A '..' at the top-level will be preserved, and an empty path is canonically '.'.

Like normalize(), but doesn't collapse "**/.." when globstar is true.

Return a ParsedPath object of the path.

Return the relative path from from to to based on current working directory.

Resolves path segments into a path

Converts a path string to a file URL.

Resolves path to a namespace path

Returns the full path destination of the named symbolic link.

Returns the full path destination of the named symbolic link.

Reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error.

Reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error.

Returns the absolute normalized path, with symbolic links resolved.

Returns the absolute normalized path, with symbolic links resolved.

Create a relative path in the OutFs. The optional second argument is the number of .. at the start, defaulting to zero.

Removes the named file or directory.

Removes the named file or directory.

Renames (moves) oldpath to newpath. Paths may be files or directories. If newpath already exists and is not a directory, Rename replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

Renames (moves) oldpath to newpath. Paths may be files or directories. If newpath already exists and is not a directory, Rename replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

Renders an OutFsPath into a unix-style path string.

Style DebuggingInformation for terminal output.

Style a filename for terminal output.

Like renderOutFsPath, but with ansi escape styling for terminal output.

Creates newpath as a symbolic link to oldpath.

Creates newpath as a symbolic link to oldpath.

Truncates (or extends) the specified file, to reach the specified len. If len is not specified then the entire file contents are truncated.

Truncates (or extends) the specified file, to reach the specified len. If len is not specified then the entire file contents are truncated.

Changes the access (atime) and modification (mtime) times of a file system object referenced by path. Given times are either in seconds (UNIX epoch time) or as Date objects.

Changes the access (atime) and modification (mtime) times of a file system object referenced by path. Given times are either in seconds (UNIX epoch time) or as Date objects.

Write the content string to the given path, by default creating a new file if needed, else overwriting.

Write the expanded child to the given path, by default creating a new file if needed, else overwriting.

Interfaces

Debugging information that can be attached to Expressions via StacktracingExpressions.

The (deliberately simple) interface we require for the logging backend.

Options for globToRegExp.

A parsed path object generated by path.parse() or consumed by path.format().

Options for globToRegExp.

A parsed path object generated by path.parse() or consumed by path.format().

Type Aliases

An expression, to be evaluated to a string.

Utility type for macros that accept an arbitrary number of children. Use with expressions to convert into an Expression[].

A logger, as created by the createLogger function.

The configuration options for an individual logger.

Describes what to do if there is already a file of some name.

  • "timid": Log error and halt.
  • "placid": Do nothing if there is already a file/directory of this name.
  • "assertive": Create a new empty directory at this name, no matter what.

A path in the OutFS.

Shared state during an evaluation that can be freely used by macros.