Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

5
test/fixtures/typescript/cts/node_modules/bar/bar.ts generated vendored Normal file
View File

@ -0,0 +1,5 @@
const bar: string = "Hello, TypeScript!";
module.exports = {
bar,
};

View File

@ -0,0 +1,13 @@
{
"name": "bar",
"version": "1.0.0",
"main": "bar.ts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1 @@
export const baz: string = 'Hello, TypeScript!';

View File

@ -0,0 +1,14 @@
{
"name": "baz",
"version": "1.0.0",
"type": "module",
"main": "baz.mts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1,5 @@
const foo: string = 'Hello, TypeScript!';
module.exports = {
foo
};

View File

@ -0,0 +1,14 @@
{
"name": "foo",
"version": "1.0.0",
"type": "commonjs",
"main": "foo.cts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1,3 @@
const foo: string = 'Hello, TypeScript!';
module.exports = { foo };

View File

@ -0,0 +1,5 @@
import util from 'node:util';
export const text: string = 'Hello, TypeScript!';
console.log(util.styleText(['bold', 'red'], text));

View File

@ -0,0 +1,3 @@
const foo: string = 'Hello, TypeScript!';
module.exports = { foo };

View File

@ -0,0 +1,5 @@
const { foo } = require('foo');
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,3 @@
const { foo } = require('./test-commonjs-export');
console.log(foo);

View File

@ -0,0 +1,5 @@
import util = require("node:util");
const foo: string = "Hello, TypeScript!";
console.log(util.styleText(["red"], foo));

View File

@ -0,0 +1,5 @@
const { baz } = require('baz');
interface Foo { };
console.log(baz);

View File

@ -0,0 +1,5 @@
const { foo } = require('./test-cts-export-foo.cts');
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,5 @@
const { foo } = require('../mts/test-mts-export-foo.mts');
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,5 @@
const { foo } = require('./test-commonjs-export.ts');
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,5 @@
const { bar } = require('bar');
interface Foo { };
console.log(bar);

View File

@ -0,0 +1,2 @@
'use strict';
console.log(process.features.typescript);

5
test/fixtures/typescript/mts/node_modules/bar/bar.ts generated vendored Normal file
View File

@ -0,0 +1,5 @@
const bar: string = 'Hello, TypeScript!'
module.exports = {
bar
};

View File

@ -0,0 +1,13 @@
{
"name": "bar",
"version": "1.0.0",
"main": "bar.ts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1 @@
export const baz: string = 'Hello, TypeScript!';

View File

@ -0,0 +1,13 @@
{
"name": "baz",
"version": "1.0.0",
"main": "baz.mts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1,5 @@
const foo: string = 'Hello, TypeScript!';
module.exports = {
foo
};

View File

@ -0,0 +1,14 @@
{
"name": "foo",
"version": "1.0.0",
"type": "commonjs",
"main": "foo.cts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1,5 @@
import { foo } from 'foo';
interface Foo { };
console.log(foo);

View File

@ -0,0 +1,5 @@
import { foo } from '../cts/test-cts-export-foo.cts';
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,5 @@
import { foo } from './test-mts-export-foo.mts';
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,5 @@
import { foo } from './test-module-export.ts';
interface Foo {};
console.log(foo);

View File

@ -0,0 +1 @@
export const foo: string = 'Hello, TypeScript!';

View File

@ -0,0 +1,9 @@
const util = require('node:util');
const text: string = 'Hello, TypeScript!';
console.log(util.styleText(['bold', 'red'], text));
module.exports = {
text
};

View File

@ -0,0 +1 @@
export const foo: string = 'Hello, TypeScript!';

View File

@ -0,0 +1,5 @@
import { baz } from 'baz';
interface Foo {};
console.log(baz);

View File

@ -0,0 +1,5 @@
import { bar } from 'bar';
interface Foo {};
console.log(bar);

View File

@ -0,0 +1,5 @@
const logger = (): void => { };
module.exports = {
logger
}

11
test/fixtures/typescript/ts/hook.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import type { ResolveHook } from 'node:module';
// Pass through
export const resolve: ResolveHook = async function resolve(specifier, context, nextResolve) {
if(false){
// https://github.com/nodejs/node/issues/54645
// A bug in the typescript parsers swc causes
// the next line to not be parsed correctly
}
return nextResolve(specifier, context);
};

View File

@ -0,0 +1,4 @@
// https://github.com/nodejs/node/issues/54457
const { text } = await import('./test-require.ts');
console.log(text);

View File

@ -0,0 +1 @@
export const logger = (): void => { };

3
test/fixtures/typescript/ts/node_modules/bar/bar.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
const bar: string = 'Hello, TypeScript!';
module.exports = { bar };

View File

@ -0,0 +1,13 @@
{
"name": "bar",
"version": "1.0.0",
"main": "bar.ts",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

1
test/fixtures/typescript/ts/node_modules/foo/foo.js generated vendored Normal file
View File

@ -0,0 +1 @@
export const foo = "Hello, TypeScript!"

View File

@ -0,0 +1,14 @@
{
"name": "foo",
"version": "1.0.0",
"type": "module",
"main": "foo.js",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1,9 @@
const util = require('node:util');
const text: string = 'Hello, TypeScript!';
console.log(util.styleText(['bold', 'red'], text));
module.exports = {
text
};

View File

@ -0,0 +1,5 @@
const str: string = "Hello, TypeScript!";
interface Foo {
bar: string;
}
console.log(str);

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,13 @@
enum Color {
Red,
Green,
Blue,
}
console.log(Color.Red);
console.log(Color.Green);
console.log(Color.Blue);
console.log(Color[0]);
console.log(Color[1]);
console.log(Color[2]);

View File

@ -0,0 +1,14 @@
function sealed(constructor: Function) {
Object.seal(constructor);
Object.seal(constructor.prototype);
}
@sealed
class BugReport {
type = "report";
title: string;
constructor(t: string) {
this.title = t;
}
}

View File

@ -0,0 +1 @@
export const foo: string = "Hello, TypeScript!";

View File

@ -0,0 +1,10 @@
const { getCallSites } = require('node:util');
interface CallSite {
A;
B;
}
const callSite = getCallSites({ sourceMap: false })[0];
console.log('mapCallSites: ', callSite);

View File

@ -0,0 +1,10 @@
const { getCallSites } = require('node:util');
interface CallSite {
A;
B;
}
const callSite = getCallSites()[0];
console.log('getCallSites: ', callSite);

View File

@ -0,0 +1,5 @@
import { foo } from './test-export-foo.ts';
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,2 @@
import fs from 'fs';
console.log('Hello, TypeScript!');

View File

@ -0,0 +1,5 @@
import { foo } from './test-no-extensions';
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,7 @@
import { MyType } from './test-types.d.ts';
const myVar: MyType = {
foo: 'Hello, TypeScript!'
};
console.log(myVar.foo);

View File

@ -0,0 +1,5 @@
import { bar } from 'bar';
interface Bar {};
console.log(bar);

View File

@ -0,0 +1,7 @@
import type { MyType } from './test-types.d.ts';
const myVar: MyType = {
foo: 'Hello, TypeScript!'
};
console.log(myVar.foo);

View File

@ -0,0 +1,3 @@
function foo(): string {
await Promise.resolve(1);
}

View File

@ -0,0 +1,4 @@
import { register } from 'node:module';
import * as fixtures from '../../../common/fixtures.mjs';
register(fixtures.fileURL('typescript/ts/hook.ts'));

View File

@ -0,0 +1,23 @@
import { before, mock, test } from 'node:test';
import { strictEqual } from 'node:assert';
const logger = mock.fn((s) => console.log(`Hello, ${s}!`));
before(async () => {
mock.module('./module-logger.ts', {
namedExports: { logger }
});
mock.module('./commonjs-logger.ts', {
namedExports: { logger }
});
});
test('logger', async () => {
const { logger: mockedModule } = await import('./module-logger.ts');
mockedModule('TypeScript-Module');
strictEqual(logger.mock.callCount(), 1);
const { logger: mockedCommonjs } = await import('./commonjs-logger.ts');
mockedCommonjs('TypeScript-CommonJS');
strictEqual(logger.mock.callCount(), 2);
});

View File

@ -0,0 +1,5 @@
import util from 'node:util';
export const text: string = 'Hello, TypeScript!';
console.log(util.styleText("red", text));

View File

@ -0,0 +1,9 @@
/// <reference path="a.ts" />
namespace Validation {
const lettersRegexp = /^[A-Za-z]+$/;
export class LettersOnlyValidator {
isAcceptable(s: string) {
return lettersRegexp.test(s);
}
}
}

View File

@ -0,0 +1 @@
export const foo: string = 'Hello, TypeScript!';

View File

@ -0,0 +1,15 @@
interface Bar {
name: string;
age: number;
}
class Test<T> {
constructor(private value: T) {}
public getValue(): T {
return this.value;
}
}
const foo = new Test<Bar>({ age: 42, name: 'John Doe' });
console.log(foo.getValue());

View File

@ -0,0 +1,5 @@
const { foo } = require('../cts/test-cts-export-foo.cts');
interface Foo {};
console.log(foo);

View File

@ -0,0 +1,3 @@
const { foo } = require('../mts/test-mts-export-foo.mts');
console.log(foo);

View File

@ -0,0 +1,5 @@
const { foo } = require('../mts/test-mts-export-foo.mts');
interface Foo { };
console.log(foo);

View File

@ -0,0 +1,7 @@
const util = require('node:util');
const text = 'Hello, TypeScript!';
module.exports = {
text
};

View File

@ -0,0 +1,2 @@
const str = "Hello, TypeScript!";
console.log(str);

View File

@ -0,0 +1,3 @@
export type MyType = {
foo: string;
};

View File

@ -0,0 +1,3 @@
import { foo } from 'foo';
console.log(foo);

View File

@ -0,0 +1,5 @@
const str: string = "Hello, TypeScript!";
interface Foo {
bar: string;
}
console.log(str);

View File

@ -0,0 +1,53 @@
// Use Some Union Types Together
const getTypescript = async () => {
return {
name: 'Hello, TypeScript!',
};
};
type MyNameResult = Awaited<ReturnType<typeof getTypescript>>;
const myNameResult: MyNameResult = {
name: 'Hello, TypeScript!',
};
console.log(myNameResult);
type RoleAttributes =
| {
role: 'admin';
permission: 'all';
}
| {
role: 'user';
}
| {
role: 'manager';
};
// Union Type: Extract
type AdminRole = Extract<RoleAttributes, { role: 'admin' }>;
const adminRole: AdminRole = {
role: 'admin',
permission: 'all',
};
console.log(adminRole);
type MyType = {
foo: string;
bar: number;
zoo: boolean;
metadata?: unknown;
};
// Union Type: Partial
type PartialType = Partial<MyType>;
const PartialTypeWithValues: PartialType = {
foo: 'Testing Partial Type',
bar: 42,
zoo: true,
metadata: undefined,
};
console.log(PartialTypeWithValues);

View File

@ -0,0 +1,5 @@
interface Foo {
bar: string;
}
throw new Error("Whitespacing");

View File

@ -0,0 +1,10 @@
function greet(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
descriptor.value = () => console.log('Hello, TypeScript!');
}
class Greeter {
@greet
sayHi() { }
}
new Greeter().sayHi();

View File

@ -0,0 +1,4 @@
enum Foo {
A = "Hello, TypeScript!",
}
throw new Error(Foo.A);

View File

@ -0,0 +1,4 @@
enum Foo {
A = "Hello, TypeScript!",
}
console.log(Foo.A);

View File

@ -0,0 +1,12 @@
module Greeter {
export interface Person {
name: string;
}
export function greet(person: Person): string {
return `Hello, ${person.name}!`;
}
}
const user: Greeter.Person = { name: "TypeScript" };
console.log(Greeter.greet(user));

View File

@ -0,0 +1,12 @@
class Foo {
foo = "Hello, TypeScript!";
}
class Bar extends Foo {
get foo() {
return "I'm legacy and should not be called!"
}
set foo(v) { }
}
console.log(new Bar().foo);

View File

@ -0,0 +1,7 @@
namespace Greeting {
export function sayHello(name: string) {
return `Hello, ${name}!`;
}
}
console.log(Greeting.sayHello("TypeScript!"));

View File

@ -0,0 +1,36 @@
var Mathematics;
(function (Mathematics) {
let Operation;
(function (Operation) {
Operation[Operation["Add"] = 0] = "Add";
Operation[Operation["Subtract"] = 1] = "Subtract";
Operation[Operation["Multiply"] = 2] = "Multiply";
Operation[Operation["Divide"] = 3] = "Divide";
})(Operation = Mathematics.Operation || (Mathematics.Operation = {}));
class Calculator {
op;
constructor(op) {
this.op = op;
}
perform(a, b) {
switch (this.op) {
case 0:
return a + b;
case 1:
return a - b;
case 2:
return a * b;
case 3:
if (b === 0) throw new Error("Division by zero!");
return a / b;
default:
throw new Error("Unknown operation");
}
}
}
Mathematics.Calculator = Calculator;
})(Mathematics || (Mathematics = {}));
throw new Error("Stacktrace at line 28");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QtZmFpbGluZy1hcm02NC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO1VBQ1U7O2NBQ007Ozs7O09BQUEsd0JBQUEsMEJBQUE7SUFPTCxNQUFNOztRQUNULFlBQVksQUFBUSxFQUFhLENBQUU7aUJBQWYsS0FBQTtRQUFpQjtRQUVyQyxRQUFRLENBQVMsRUFBRSxDQUFTLEVBQVU7WUFDbEMsT0FBUSxJQUFJLENBQUMsRUFBRTtnQkFDWDtvQkFBb0IsT0FBTyxJQUFJO2dCQUMvQjtvQkFBeUIsT0FBTyxJQUFJO2dCQUNwQztvQkFBeUIsT0FBTyxJQUFJO2dCQUNwQztvQkFDSSxJQUFJLE1BQU0sR0FBRyxNQUFNLElBQUksTUFBTTtvQkFDN0IsT0FBTyxJQUFJO2dCQUNmO29CQUNJLE1BQU0sSUFBSSxNQUFNO1lBQ3hCO1FBQ0o7SUFDSjtnQkFmYSxhQUFBO0FBZ0JqQixHQXhCVSxnQkFBQTtBQTBCVixNQUFNLElBQUksTUFBTSJ9

View File

@ -0,0 +1,3 @@
// @ts-ignore
import { missing } from ".";
export { };