From ca0d4506789d5b69bd4ebdaa01bb0cf9bf3c6ffb Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Tue, 6 Aug 2024 11:11:29 +0200 Subject: [PATCH 1/2] chore: update import.meta API code blocks --- runtime/manual/runtime/import_meta_api.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/runtime/manual/runtime/import_meta_api.md b/runtime/manual/runtime/import_meta_api.md index e28526636..04ca4071d 100644 --- a/runtime/manual/runtime/import_meta_api.md +++ b/runtime/manual/runtime/import_meta_api.md @@ -10,8 +10,7 @@ API: Returns the URL of the current module. -```ts -// main.ts +```ts title="main.ts" console.log(import.meta.url); ``` @@ -27,13 +26,13 @@ https://example.com/main.ts Returns whether the current module is the entry point to your program. -```ts -// main.ts +```ts title="main.ts" import "./other.ts"; console.log(`Is ${import.meta.url} the main module?`, import.meta.main); +``` -// other.ts +```ts title="other.ts" console.log(`Is ${import.meta.url} the main module?`, import.meta.main); ``` @@ -51,8 +50,7 @@ _This property is only available for local modules (module that have Returns the fully resolved path to the current module. The value contains OS specific path separators. -```ts -// main.ts +```ts title="main.ts" console.log(import.meta.filename); ``` @@ -84,8 +82,7 @@ _This property is only available for local modules (module that have Returns the fully resolved path to the directory containing the current module. The value contains OS specific path separators. -```ts -// main.ts +```ts title="main.ts" console.log(import.meta.dirname); ``` @@ -132,8 +129,7 @@ With such import map loaded... ...you can now resolve: -```js -// resolve.js +```js title="resolve.js" console.log(import.meta.resolve("fresh")); ``` From 8137ca31edd3a1f1232ced27deb2e81af8a9591d Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Tue, 6 Aug 2024 11:13:29 +0200 Subject: [PATCH 2/2] chore: enhance import.meta intro text --- runtime/manual/runtime/import_meta_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/manual/runtime/import_meta_api.md b/runtime/manual/runtime/import_meta_api.md index 04ca4071d..3ed8473ef 100644 --- a/runtime/manual/runtime/import_meta_api.md +++ b/runtime/manual/runtime/import_meta_api.md @@ -4,7 +4,7 @@ title: "`import.meta` API" Deno supports a number of properties and methods on the [`import.meta`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) -API: +API. It can be used to get information about the module like the module's URL. ## `import.meta.url`