Skip to content

Commit

Permalink
refactor: add node: prefix on imported native nodejs module
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Jan 18, 2025
1 parent 4b7592d commit df87fa0
Show file tree
Hide file tree
Showing 126 changed files with 245 additions and 165 deletions.
4 changes: 2 additions & 2 deletions docs/docs/platform-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Or use the `app.statics()` method:
```typescript [Decorators]
import {Injectable} from "@tsed/di";
import {PlatformApplication} from "@tsed/platform-http";
import {join} from "path";
import {join} from "node:path";

@Injectable()
export class MyService {
Expand All @@ -218,7 +218,7 @@ export class MyService {
```typescript [Functional API]
import {injectable} from "@tsed/di";
import {application} from "@tsed/platform-http";
import {join} from "path";
import {join} from "node:path";

export class MyService {
protected app = application();
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/snippets/controllers/inject-next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Next, Req, Res} from "@tsed/platform-http";
import {Get} from "@tsed/schema";
import {Controller} from "@tsed/di";
import * as Express from "express";
import {promisify} from "util";
import {promisify} from "node:util";

@Controller("/calendars")
export class CalendarCtrl {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/snippets/controllers/inject-req-res-node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Req, Res} from "@tsed/platform-http";
import {Get} from "@tsed/schema";
import {Controller} from "@tsed/di";
import {IncomingMessage, ServerResponse} from "http";
import {IncomingMessage, ServerResponse} from "node:http";

@Controller("/calendars")
export class CalendarCtrl {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/snippets/model/pagination-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {PlatformTest} from "@tsed/platform-http/testing";
import {getSpec, SpecTypes} from "@tsed/schema";
import * as qs from "querystring";
import * as qs from "node:querystring";
import * as SuperTest from "supertest";
import {PaginationFilter} from "../filters/PaginationFilter";
import {ProductsCtrl} from "./ProductsCtrl";
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/graphql-apollo.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ npm install --save-dev apollo-server-testing
import {Configuration} from "@tsed/di";
import "@tsed/platform-express";
import "@tsed/apollo";
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand Down Expand Up @@ -76,7 +76,7 @@ You can register plugins with the `plugins` property. The plugins are executed i
import {Configuration} from "@tsed/di";
import "@tsed/platform-express";
import "@tsed/apollo";
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand All @@ -94,8 +94,8 @@ you can register the `graphql-ws` necessary to support the `subscription` featur
```typescript
import {Constant, Inject, InjectorService, Module} from "@tsed/di";
import {useServer} from "graphql-ws/lib/use/ws";
import Http from "http";
import Https from "https";
import Http from "node:http";
import Https from "node:https";
import {WebSocketServer} from "ws";
import {GraphQLWSOptions} from "./GraphQLWSOptions";

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/graphql-nexus.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {Configuration} from "@tsed/di";
import "@tsed/platform-express";
import "@tsed/apollo";
import {schema} from "./schema";
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand All @@ -67,7 +67,7 @@ Then create `schema/index.ts`:

```typescript
import {makeSchema} from "nexus";
import {join} from "path";
import {join} from "node:path";

export const schema = makeSchema({
types: [], // 1
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/graphql-ws.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {Configuration} from "@tsed/di";
import "@tsed/platform-express";
import "@tsed/apollo";
import "@tsed/graphql-ws"; // auto import plugin for @tsed/apollo
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand Down Expand Up @@ -120,7 +120,7 @@ import "@tsed/platform-express";
import "@tsed/apollo";
import "@tsed/typegraphql";
import "@tsed/graphql-ws"; // auto import plugin for @tsed/apollo
import {join} from "path";
import {join} from "node:path";
import {pubsub} from "./pubsub/pubsub";

@Configuration({
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/snippets/graphql/graphql-ws.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {Configuration} from "@tsed/common";
import "@tsed/platform-express";
import "@tsed/apollo";
import "@tsed/graphql-ws";
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand Down Expand Up @@ -90,7 +90,7 @@ You can register plugins with the `plugins` property. The plugins are executed i
import {Configuration} from "@tsed/common";
import "@tsed/platform-express";
import "@tsed/apollo";
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand All @@ -108,8 +108,8 @@ you can register the `graphql-ws` necessary to support the `subscription` featur
```typescript
import {Constant, Inject, InjectorService, Module} from "@tsed/di";
import {useServer} from "graphql-ws/lib/use/ws";
import Http from "http";
import Https from "https";
import Http from "node:http";
import Https from "node:https";
import {WebSocketServer} from "ws";
import {GraphQLWSOptions} from "./GraphQLWSOptions";

Expand Down Expand Up @@ -199,7 +199,7 @@ import {Configuration} from "@tsed/common";
import "@tsed/platform-express";
import "@tsed/apollo";
import {schema} from "./schema";
import {join} from "path";
import {join} from "node:path";

@Configuration({
apollo: {
Expand All @@ -226,7 +226,7 @@ Then create `schema/index.ts`:

```typescript
import {makeSchema} from "nexus";
import {join} from "path";
import {join} from "node:path";

export const schema = makeSchema({
types: [], // 1
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/terminus.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Then import `@tsed/terminus` and add the following configuration in your `Server
```typescript
import {Configuration} from "@tsed/di";
import "@tsed/terminus"; // import terminus Ts.ED module
import {resolve} from "path";
import {resolve} from "node:path";

@Configuration({
terminus: {
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/vike.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ npm install vike @tsed/vike vite@4 --save
Then edit your `Server.ts`:

```ts
import {join} from "path";
import {join} from "node:path";
import {Configuration, Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";
import "@tsed/platform-express"; // /!\ keep this import
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/domain/AnyToPromise.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {createReadStream} from "fs";
import {createReadStream} from "node:fs";

import {of} from "rxjs";

import {catchAsyncError} from "../utils/catchError.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/di/src/node/utils/asyncHookContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AsyncLocalStorage, AsyncResource} from "async_hooks";
import {AsyncLocalStorage, AsyncResource} from "node:async_hooks";

import {InjectorService} from "../../common/index.js";
import type {DIContext} from "../domain/DIContext.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/engines/src/components/DustEngine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {extname} from "path";
import {promisify} from "util";
import {extname} from "node:path";
import {promisify} from "node:util";

import {ViewEngine} from "../decorators/viewEngine.js";
import {read} from "../utils/cache.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/EctEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {promisify} from "util";
import {promisify} from "node:util";

import {ViewEngine} from "../decorators/viewEngine.js";
import {Engine} from "./Engine.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/HoganEngine.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {join} from "path";
import {join} from "node:path";

import {getEngineFixture} from "../../test/getEngineFixture.js";
import {HoganEngine} from "./HoganEngine.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/JustEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {promisify} from "util";
import {promisify} from "node:util";

import {ViewEngine} from "../decorators/viewEngine.js";
import {Engine} from "./Engine.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/NunjucksEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {promisify} from "util";
import {promisify} from "node:util";

import {ViewEngine} from "../decorators/viewEngine.js";
import {Engine} from "./Engine.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/engines/src/components/ReactEngine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {readFileSync} from "fs";
import {resolve} from "path";
import {readFileSync} from "node:fs";
import {resolve} from "node:path";

import {ViewEngine} from "../decorators/viewEngine.js";
import {getCachedEngine, getFromCache, importEngine, setToCache} from "../utils/cache.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/SquirrellyEngine.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {join} from "path";
import {join} from "node:path";

import {getEngineFixture} from "../../test/getEngineFixture.js";
import {requires} from "../utils/cache.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/TwingEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {existsSync} from "fs";
import {existsSync} from "node:fs";

import {ViewEngine} from "../decorators/viewEngine.js";
import {Engine} from "./Engine.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/components/VashEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {promisify} from "util";
import {promisify} from "node:util";

import {ViewEngine} from "../decorators/viewEngine.js";
import {Engine} from "./Engine.js";
Expand Down
3 changes: 1 addition & 2 deletions packages/engines/src/utils/cache.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from "node:fs";
import {readFile} from "node:fs/promises";
import {dirname, extname, isAbsolute, join} from "node:path";

import fs from "fs";

const readCache: Map<string, string> = new Map();
const cacheStore: Map<string, any> = new Map();

Expand Down
2 changes: 1 addition & 1 deletion packages/engines/src/utils/getEngines.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../index.js";

import {join} from "path";
import {join} from "node:path";

import {getEngine, getEngines} from "./getEngines.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/engines/test/getEngineFixture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "fs";
import fs from "node:fs";

import {Engine} from "../src/components/Engine.js";
import {engines} from "../src/index.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/engines/test/shared/dust.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {join} from "path";
import fs from "node:fs";
import {join} from "node:path";

import {engines, requires} from "../../src/index.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/engines/test/shared/filters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {join} from "path";
import fs from "node:fs";
import {join} from "node:path";

import {engines} from "../../src/index.js";

Expand Down
5 changes: 3 additions & 2 deletions packages/engines/test/shared/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from "fs";
import fs from "node:fs";
import {join} from "node:path";

import handlebars from "handlebars";
import {join} from "path";

import {engines} from "../../src/index.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/engines/test/shared/includes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {join} from "path";
import fs from "node:fs";
import {join} from "node:path";

import {engines} from "../../src/index.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/engines/test/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {join} from "path";
import fs from "node:fs";
import {join} from "node:path";

import {engines, requires} from "../../src/index.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/engines/test/shared/partials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {join} from "path";
import fs from "node:fs";
import {join} from "node:path";

import {engines} from "../../src/index.js";

Expand Down
4 changes: 2 additions & 2 deletions packages/engines/test/shared/react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import {join} from "path";
import fs from "node:fs";
import {join} from "node:path";

import {engines} from "../../src/index.js";

Expand Down
5 changes: 3 additions & 2 deletions packages/graphql/apollo/src/services/ApolloService.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Http from "node:http";
import Https from "node:https";

import {ApolloServer, ApolloServerOptions, ApolloServerPlugin} from "@apollo/server";
import {ApolloServerPluginLandingPageDisabled} from "@apollo/server/plugin/disabled";
import {ApolloServerPluginDrainHttpServer} from "@apollo/server/plugin/drainHttpServer";
Expand All @@ -7,8 +10,6 @@ import {Constant, context, Inject, InjectorService, LocalsContainer, Provider, S
import {Logger} from "@tsed/logger";
import {PlatformApplication, PlatformContext} from "@tsed/platform-http";
import type {GraphQLSchema} from "graphql";
import Http from "http";
import Https from "https";

import {APOLLO_CONTEXT, DATASOURCES_PROVIDERS} from "../constants/constants.js";
import {ApolloContext} from "../interfaces/ApolloContext.js";
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql/graphql-ws/src/GraphQLWSModule.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Http from "node:http";
import Https from "node:https";

import {Constant, Inject, InjectorService, Module} from "@tsed/di";
import type {Disposable} from "graphql-ws";
import {useServer} from "graphql-ws/lib/use/ws";
import Http from "http";
import Https from "https";

import {GraphQLWSOptions} from "./GraphQLWSOptions.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/typegraphql/test/app/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import "@tsed/platform-log-request";

import * as fs from "node:fs";
import {join} from "node:path";
import {resolve} from "node:path";

import {ApolloContext} from "@tsed/apollo";
import {Configuration, Constant, Inject} from "@tsed/di";
import {PlatformApplication, PlatformContext} from "@tsed/platform-http";
import {buildContext} from "graphql-passport";
import {resolve} from "path";

import {HelloController} from "./controllers/HelloController.js";
import {User} from "./graphql/auth/User.js";
Expand Down
3 changes: 2 additions & 1 deletion packages/orm/adapters/src/adapters/FileSyncAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {dirname} from "node:path";

import {nameOf} from "@tsed/core";
import {Configuration, Injectable, Opts, ProviderScope, Scope} from "@tsed/di";
import fs from "fs-extra";
import {LowSync} from "lowdb";
import {JSONFileSync} from "lowdb/node";
import {dirname} from "path";

import {AdapterConstructorOptions} from "../domain/Adapter.js";
import {AdapterModel, LowDbAdapter, type LowModel} from "./LowDbAdapter.js";
Expand Down
3 changes: 2 additions & 1 deletion packages/orm/objection/src/components/createIdColumn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {randomUUID} from "crypto";
import {randomUUID} from "node:crypto";

import type {Knex} from "knex";

import {ColumnTypesContainer} from "../services/ColumnTypesContainer.js";
Expand Down
3 changes: 2 additions & 1 deletion packages/orm/prisma/src/__mock__/createProjectFixture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {join} from "path";
import {join} from "node:path";

import {ModuleKind, Project, ScriptTarget} from "ts-morph";

const rootDir = import.meta.dirname; // automatically replaced by import.meta.dirname on build
Expand Down
Loading

0 comments on commit df87fa0

Please sign in to comment.