Identifiers, extensions, and the .mjs file
An identifier is simply a name that points to one thing and distinguishes it from everything else — the same idea as a person's name or a license plate. In code, identifiers name variables and functions; in a filesystem, the extension names the file's type. A .mjs file is one specific case: JavaScript that Node.js must treat as an ES module.
What an identifier is
- Identifier = a label that uniquely points to something, so you can refer back to it later.
- In programming it names a variable (a labelled box holding data) or a function (a named block of processing): in let price = 100, the word price is the identifier.
- The computer doesn't remember '100' loosely — it remembers 'the box named price holds 100', and price is how you fetch it again.
A file extension is a kind of identifier too
- Extension = the '.xxx' at the end of a filename that signals what kind of file it is: .jpg (image), .pdf (document), .js (JavaScript).
- Strictly, 'identifier' in programming means variable/function names, and extensions are a separate category — but both share one root idea: a name that distinguishes one thing from another.
- The OS and other programs read the extension to decide how to open or run the file.
So what is .mjs?
- .js is a JavaScript file — the language that runs websites and tools. .mjs is JavaScript that Node.js is required to treat as an ES module.
- A module is a reusable part of a program: large software is split into parts (A, B, C…) and combined via import / export (commands that pass parts between files).
- Node.js normally guesses module vs. script from package.json's 'type' field: the .mjs extension overrides that guess and forces ES-module handling, regardless of the setting.
- This repo uses files like gen-notes-manifest.mjs to auto-build the note index — the .mjs makes import/export usable without extra config.
識別子・拡張子、そして .mjs ファイルの正体
識別子(=identifier、あるものを他と区別して指し示す名前)は、人の名前や車のナンバープレートとまったく同じ発想だ。プログラムの中では変数や関数に名前を付け、ファイルの世界では拡張子がファイルの種類を指し示す。.mjs はその一例——Node.js(=サーバー側などでJavaScriptを動かす実行環境)が「ESモジュールとして扱え」と判定するためのJavaScriptファイルだ。
識別子とは何か
- 識別子=あるものを一意に指すためのラベル。後からそれを呼び出せるようにするための名前。
- プログラムでは、変数(=データを入れておく名前付きの箱)や関数(=処理のかたまり)に名前を付ける。let price = 100 なら price が識別子。
- コンピュータは「100」を漠然と覚えるのではなく「price という名前の箱に100が入っている」と管理する。price と書けば再びその値を取り出せる。
拡張子も識別子の一種
- 拡張子(=extension)=ファイル名の末尾の「.○○」で、そのファイルが何の種類かを指し示す。.jpg(画像)・.pdf(文書)・.js(JavaScript)。
- 厳密には、プログラミング用語の「識別子」は変数名・関数名を指し、拡張子は別カテゴリ——ただし「何かを区別して指す名前」という根っこの発想は同じ。
- OS(=基本ソフト)や他のプログラムは、この拡張子を読んで「どう開くか・どう実行するか」を決める。
では .mjs とは?
- .js は JavaScript(=Webサイトやツールを動かす言語)のファイル。.mjs は Node.js が必ず「ESモジュール」として扱うJavaScript。
- モジュール(module)=プログラムを機能ごとに分けた再利用できる部品。大きなソフトを部品A・B・C…に分け、import / export(=部品を他ファイルと出し入れする命令)で組み合わせる。
- Node.js は通常 package.json の「type」欄でモジュールかスクリプトかを推測するが、.mjs 拡張子はその推測を上書きし、設定に関わらずESモジュール扱いを強制する。
- このリポジトリでは gen-notes-manifest.mjs のようなファイルでノート一覧を自動生成している。.mjs にすることで、追加設定なしに import/export が使える。
Identifiers, extensions, and the .mjs file
An identifier is simply a name that points to one thing and distinguishes it from everything else — the same idea as a person's name or a license plate. In code, identifiers name variables and functions; in a filesystem, the extension names the file's type. A .mjs file is one specific case: JavaScript that Node.js must treat as an ES module.
What an identifier is
- Identifier = a label that uniquely points to something, so you can refer back to it later.
- In programming it names a variable (a labelled box holding data) or a function (a named block of processing): in let price = 100, the word price is the identifier.
- The computer doesn't remember '100' loosely — it remembers 'the box named price holds 100', and price is how you fetch it again.
A file extension is a kind of identifier too
- Extension = the '.xxx' at the end of a filename that signals what kind of file it is: .jpg (image), .pdf (document), .js (JavaScript).
- Strictly, 'identifier' in programming means variable/function names, and extensions are a separate category — but both share one root idea: a name that distinguishes one thing from another.
- The OS and other programs read the extension to decide how to open or run the file.
So what is .mjs?
- .js is a JavaScript file — the language that runs websites and tools. .mjs is JavaScript that Node.js is required to treat as an ES module.
- A module is a reusable part of a program: large software is split into parts (A, B, C…) and combined via import / export (commands that pass parts between files).
- Node.js normally guesses module vs. script from package.json's 'type' field: the .mjs extension overrides that guess and forces ES-module handling, regardless of the setting.
- This repo uses files like gen-notes-manifest.mjs to auto-build the note index — the .mjs makes import/export usable without extra config.
識別子・拡張子、そして .mjs ファイルの正体
識別子(=identifier、あるものを他と区別して指し示す名前)は、人の名前や車のナンバープレートとまったく同じ発想だ。プログラムの中では変数や関数に名前を付け、ファイルの世界では拡張子がファイルの種類を指し示す。.mjs はその一例——Node.js(=サーバー側などでJavaScriptを動かす実行環境)が「ESモジュールとして扱え」と判定するためのJavaScriptファイルだ。
識別子とは何か
- 識別子=あるものを一意に指すためのラベル。後からそれを呼び出せるようにするための名前。
- プログラムでは、変数(=データを入れておく名前付きの箱)や関数(=処理のかたまり)に名前を付ける。let price = 100 なら price が識別子。
- コンピュータは「100」を漠然と覚えるのではなく「price という名前の箱に100が入っている」と管理する。price と書けば再びその値を取り出せる。
拡張子も識別子の一種
- 拡張子(=extension)=ファイル名の末尾の「.○○」で、そのファイルが何の種類かを指し示す。.jpg(画像)・.pdf(文書)・.js(JavaScript)。
- 厳密には、プログラミング用語の「識別子」は変数名・関数名を指し、拡張子は別カテゴリ——ただし「何かを区別して指す名前」という根っこの発想は同じ。
- OS(=基本ソフト)や他のプログラムは、この拡張子を読んで「どう開くか・どう実行するか」を決める。
では .mjs とは?
- .js は JavaScript(=Webサイトやツールを動かす言語)のファイル。.mjs は Node.js が必ず「ESモジュール」として扱うJavaScript。
- モジュール(module)=プログラムを機能ごとに分けた再利用できる部品。大きなソフトを部品A・B・C…に分け、import / export(=部品を他ファイルと出し入れする命令)で組み合わせる。
- Node.js は通常 package.json の「type」欄でモジュールかスクリプトかを推測するが、.mjs 拡張子はその推測を上書きし、設定に関わらずESモジュール扱いを強制する。
- このリポジトリでは gen-notes-manifest.mjs のようなファイルでノート一覧を自動生成している。.mjs にすることで、追加設定なしに import/export が使える。
Related notes
- Agentic Commerce — ACP and Visibility into Being 'Bought by AI'
- AI Search Evaluation: The 12 Metrics — Gateway
- AI Search Evaluation ①Citation Rate — How Many URLs Are Pulled In Per Answer
- AI Search Evaluation ②Source Diversity — How Unskewed the Cited Sources Are
- AI Search Evaluation ③Accuracy Score — How Often It Answers Factual Questions Correctly
- AI Search Evaluation ④Answer Length — How Many Characters It Returns to the User on Average