Hacker News new | ask | show | jobs
by unilynx 1128 days ago
import.meta.main (whether the current file is the 'main' or just being required) looks interesting and like something I have wanted in the past, but not sure if it would actually be a good idea.

was it ever offered for standardisation?

1 comments

There is no standard, import.meta is host-defined:

    13.3.12.1.1 HostGetImportMetaProperties ( moduleRecord )

    The host-defined abstract operation HostGetImportMetaProperties takes argument moduleRecord (a Module Record) and returns a List of Records with fields [[Key]] (a property key) and [[Value]] (an ECMAScript language value). It allows hosts to provide property keys and values for the object returned from import.meta.
https://tc39.es/ecma262/#sec-hostgetimportmetaproperties