Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/comparators/file-size.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { stat, readdir } from 'node:fs/promises';
import path from 'node:path';

import { BASE, HEAD, TITLE } from './constants.mjs';
import { BASE, HEAD, TITLE } from '../constants.mjs';

const UNITS = ['B', 'KB', 'MB', 'GB'];

Expand Down
2 changes: 1 addition & 1 deletion scripts/comparators/object-assertion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'node:assert';
import { readdir, readFile } from 'node:fs/promises';
import { join } from 'node:path';

import { BASE, HEAD, TITLE } from './constants.mjs';
import { BASE, HEAD, TITLE } from '../constants.mjs';

const files = await readdir(BASE);

Expand Down
20 changes: 10 additions & 10 deletions src/generators/metadata/maps/builtin.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"asynciterable": "https://tc39.github.io/ecma262/#sec-asynciterable-interface",
"module namespace object": "https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects",
"null": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/null",
"undefined": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/undefined",
"boolean": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/boolean",
"number": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/number",
"bigint": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/bigint",
"string": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/string",
"symbol": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/symbol",
"integer": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/number",
"any": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/#Data_types",
"this": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this"
"null": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#null_type",
"undefined": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#undefined_type",
"boolean": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#boolean_type",
"number": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#number_type",
"bigint": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#bigint_type",
"string": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type",
"symbol": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#symbol_type",
"integer": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#number_type",
"any": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#Data_types",
"this": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/this"
}
14 changes: 7 additions & 7 deletions src/generators/metadata/utils/__tests__/transformers.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ describe('transformTypeToReferenceLink', () => {
it('should transform a JavaScript primitive type into a Markdown link', () => {
strictEqual(
transformTypeToReferenceLink('string'),
'[`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type)'
'[`<string>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type)'
);
});

it('should transform a JavaScript global type into a Markdown link', () => {
strictEqual(
transformTypeToReferenceLink('Array'),
'[`<Array>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)'
'[`<Array>`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)'
);
});

Expand All @@ -30,35 +30,35 @@ describe('transformTypeToReferenceLink', () => {
it('should transform a basic Generic type into a Markdown link', () => {
strictEqual(
transformTypeToReferenceLink('{Promise<string>}'),
'[`<Promise>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type)&gt;'
'[`<Promise>`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[`<string>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type)&gt;'
);
});

it('should partially transform a Generic type if only one part is known', () => {
strictEqual(
transformTypeToReferenceLink('{CustomType<string>}', {}),
'`<CustomType>`&lt;[`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type)&gt;'
'`<CustomType>`&lt;[`<string>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type)&gt;'
);
});

it('should transform a Generic type with an inner union like {Promise<string|boolean>}', () => {
strictEqual(
transformTypeToReferenceLink('{Promise<string|boolean>}', {}),
'[`<Promise>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type) | [`<boolean>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type)&gt;'
'[`<Promise>`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[`<string>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type) | [`<boolean>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#boolean_type)&gt;'
);
});

it('should transform multi-parameter generics like {Map<string, number>}', () => {
strictEqual(
transformTypeToReferenceLink('{Map<string, number>}', {}),
'[`<Map>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)&lt;[`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type), [`<number>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type)&gt;'
'[`<Map>`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)&lt;[`<string>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type), [`<number>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#number_type)&gt;'
);
});

it('should handle outer unions with generics like {Promise<string|number> | boolean}', () => {
strictEqual(
transformTypeToReferenceLink('{Promise<string|number> | boolean}', {}),
'[`<Promise>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[`<string>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type) | [`<number>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type)&gt; | [`<boolean>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type)'
'[`<Promise>`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[`<string>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type) | [`<number>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#number_type)&gt; | [`<boolean>`](https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#boolean_type)'
);
});
});
Loading