Use node prefix for node core imports.

This commit is contained in:
Dillon Kearns 2023-01-29 08:37:50 -08:00
parent 70816b8877
commit 75ed9c50e7
10 changed files with 19 additions and 20 deletions

View File

@ -1,6 +1,6 @@
import kleur from "kleur";
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
kleur.enabled = true;

View File

@ -5,8 +5,8 @@ import * as build from "./build.js";
import * as dev from "./dev-server.js";
import * as init from "./init.js";
import * as codegen from "./codegen.js";
import * as fs from "fs";
import * as path from "path";
import * as fs from "node:fs";
import * as path from "node:path";
import { restoreColorSafe } from "./error-formatter.js";
import * as renderer from "./render.js";
import { globbySync } from "globby";

View File

@ -1,4 +1,4 @@
import * as fs from "fs";
import * as fs from "node:fs";
import * as fsExtra from "fs-extra/esm";
import { rewriteElmJson } from "./rewrite-elm-json.js";
import { rewriteClientElmJson } from "./rewrite-client-elm-json.js";

View File

@ -1,5 +1,5 @@
const util = require("util");
const fsSync = require("fs");
const util = require("node:util");
const fsSync = require("node:fs");
const fs = {
writeFile: util.promisify(fsSync.writeFile),
mkdir: util.promisify(fsSync.mkdir),

View File

@ -1,6 +1,6 @@
import * as util from "util";
import * as fsSync from "fs";
import * as path from "path";
import * as util from "node:util";
import * as fsSync from "node:fs";
import * as path from "node:path";
const fs = {
writeFile: util.promisify(fsSync.writeFile),
@ -75,4 +75,3 @@ export async function copyDirNested(src, dest) {
fs.copyFile(src, dest);
}
}

View File

@ -1,4 +1,4 @@
import * as fs from "fs";
import * as fs from "node:fs";
export function ensureDirSync(dirpath) {
try {

View File

@ -1,9 +1,9 @@
import * as renderer from "../../generator/src/render.js";
import * as path from "path";
import * as path from "node:path";
import * as fs from "./dir-helpers.js";
import { readFileSync, writeFileSync } from "fs";
import { readFileSync, writeFileSync } from "node:fs";
import { stat } from "fs/promises";
import { parentPort, threadId, workerData } from "worker_threads";
import { parentPort, threadId, workerData } from "node:worker_threads";
import * as url from "url";
async function run({ mode, pathname, serverRequest, portsFilePath }) {

View File

@ -1,16 +1,16 @@
// @ts-check
import * as path from "path";
import * as path from "node:path";
import { default as mm } from "micromatch";
import { default as matter } from "gray-matter";
import * as fsPromises from "fs/promises";
import * as globby from "globby";
import * as fsPromises from "node:fs/promises";
import * as preRenderHtml from "./pre-render-html.js";
import { lookupOrPerform } from "./request-cache.js";
import * as kleur from "kleur/colors";
import * as cookie from "cookie-signature";
import { compatibilityKey } from "./compatibility-key.js";
import * as fs from "fs";
import * as fs from "node:fs";
import * as crypto from "node:crypto";
process.on("unhandledRejection", (error) => {

View File

@ -1,4 +1,4 @@
import * as fs from "fs";
import * as fs from "node:fs";
export async function rewriteClientElmJson() {
var elmJson = JSON.parse(

View File

@ -1,4 +1,4 @@
import * as fs from "fs";
import * as fs from "node:fs";
export async function rewriteElmJson(sourceElmJsonPath, targetElmJsonPath) {
var elmJson = JSON.parse(