Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.awfixer.me/llms.txt

Use this file to discover all available pages before exploring further.

The import.meta object is a way for a module to access information about itself. It’s part of the JavaScript language, but its contents are not standardized. Each “host” (browser, runtime, etc) is free to implement any properties it wishes on the import.meta object. JSTime implements the following properties.
import.meta.dir;   // => "/path/to/project"
import.meta.file;  // => "file.ts"
import.meta.path;  // => "/path/to/project/file.ts"

import.meta.main;  // `true` if this file is directly executed by `jstime run`
                   // `false` otherwise

import.meta.resolveSync("zod")
// resolve an import specifier relative to the directory
import.meta.dirAbsolute path to the directory containing the current file, e.g. /path/to/project. Equivalent to __dirname in CommonJS modules (and Node.js)
import.meta.fileThe name of the current file, e.g. index.tsx
import.meta.pathAbsolute path to the current file, e.g. /path/to/project/index.tx. Equivalent to __filename in CommonJS modules (and Node.js)
import.meta.mainboolean Indicates whether the current file is the entrypoint to the current jstime process. Is the file being directly executed by jstime run or is it being imported?
import.meta.resolve{Sync}Resolve a module specifier (e.g. "zod" or "./file.tsx) to an absolute path. While file would be imported if the specifier were imported from this file?```tsimport.meta.resolveSync(“zod”);// => “/path/to/project/node_modules/zod/index.ts”import.meta.resolveSync(”./file.tsx”);// => “/path/to/project/file.tsx”```