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
24 changes: 19 additions & 5 deletions packages/documentation/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,27 @@ const nextConfig = {
images: {
unoptimized: true,
},
webpack: (config, {buildId, dev, isServer, defaultLoaders, webpack}) => {
webpack: (config) => {
config.experiments = {...config.experiments, syncWebAssembly: true}
config.plugins.push(new NodePolyfillPlugin())
config.module.rules.push({
test: /node:.+/i,
use: "null-loader",

/**
* Webpack doesn't support `node:` prefixed imports, so rewrite them to be
* plain imports, allowing the NodePolyfillPlugin to do its job correctly.
*/
config.plugins.push({
apply(compiler) {
compiler.hooks.normalModuleFactory.tap("RewriteNodeProtocol", (nmf) => {
nmf.hooks.beforeResolve.tap("RewriteNodeProtocol", (result) => {
if (result?.request?.startsWith("node:")) {
result.request = result.request.replace(/^node:/, "")
}
})
})
},
})

config.plugins.push(new NodePolyfillPlugin())

config.module.rules.push({
test: /@biomejs\/wasm-nodejs/i,
use: "null-loader",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// TODO: webpack shouldn't be including this file?
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import {existsSync} from "fs"
import {existsSync} from "node:fs"

// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import fs from "fs/promises"
import fs from "node:fs/promises"
import type {IFsAdaptor} from "./fs-adaptor"

export class NodeFsAdaptor implements IFsAdaptor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: webpack doesn't like `node:` prefix
import path from "path"
import path from "node:path"
import yaml from "js-yaml"
import json5 from "json5"
import type {IFsAdaptor} from "../file-system/fs-adaptor"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import path from "path"
import path from "node:path"
import json5 from "json5"
import ts from "typescript"
import type {IFsAdaptor} from "../file-system/fs-adaptor"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: <explanation>
import path from "path"
import path from "node:path"
import stripJsonComments from "strip-json-comments"
import type {IFsAdaptor} from "../file-system/fs-adaptor"
import {logger} from "../logger"
Expand Down
3 changes: 1 addition & 2 deletions packages/openapi-code-generator/src/core/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import util from "util"
import util from "node:util"

export type LoggerMeta = Record<string, unknown>

Expand Down
6 changes: 2 additions & 4 deletions packages/openapi-code-generator/src/core/openapi-loader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import path from "path"
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import util from "util"
import path from "node:path"
import util from "node:util"

import * as console from "node:console"
import {load} from "js-yaml"
Expand Down
3 changes: 1 addition & 2 deletions packages/openapi-code-generator/src/core/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: webpack doesn't like node: prefix
import path from "path"
import path from "node:path"
import _ from "lodash"

export function isDefined<T>(it: T | undefined): it is T {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import path from "path"
import path from "node:path"

export class ImportBuilder {
private readonly imports: Record<string, Set<string>> = {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: webpack doesn't like node: prefix
import path from "path"
import path from "node:path"
import type {IFsAdaptor} from "../../core/file-system/fs-adaptor"
import type {IFormatter} from "../../core/interfaces"
import {logger} from "../../core/logger"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import path from "path"
import path from "node:path"
import {normalizeFilename} from "../../../core/utils"
import type {OpenapiTypescriptGeneratorConfig} from "../../../templates.types"
import {CompilationUnit} from "../../common/compilation-units"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: keep webpack happy
import path from "path"
import path from "node:path"
import {normalizeFilename} from "../../../core/utils"
import type {OpenapiTypescriptGeneratorConfig} from "../../../templates.types"
import {CompilationUnit} from "../../common/compilation-units"
Expand Down