Skip to content

Commit

Permalink
Use node: prefix for Node builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Oct 20, 2023
1 parent 2f91de1 commit 5277d55
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Benchmark.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { performance } from "perf_hooks";
import { performance } from "node:perf_hooks";

class Benchmark {
constructor() {
Expand Down
3 changes: 2 additions & 1 deletion src/BenchmarkGroup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debugUtil from "debug";

import ConsoleLogger from "./Util/ConsoleLogger.js";
import Benchmark from "./Benchmark.js";
import debugUtil from "debug";

const debugBenchmark = debugUtil("Eleventy:Benchmark");

Expand Down
3 changes: 2 additions & 1 deletion src/BenchmarkManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { performance } from "node:perf_hooks";

import BenchmarkGroup from "./BenchmarkGroup.js";
import { performance } from "perf_hooks";

// TODO this should not be a singleton, it belongs in the config or somewhere on the Eleventy instance.

Expand Down
2 changes: 1 addition & 1 deletion src/Eleventy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { performance } from "node:perf_hooks";
import { TemplatePath } from "@11ty/eleventy-utils";
import { performance } from "perf_hooks";
import debugUtil from "debug";

import TemplateData from "./TemplateData.js";
Expand Down
3 changes: 2 additions & 1 deletion src/EleventyFiles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from "fs";
import fs from "node:fs";

import { TemplatePath } from "@11ty/eleventy-utils";
import debugUtil from "debug";

Expand Down
3 changes: 2 additions & 1 deletion src/EventBus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import EventEmitter from "./Util/AsyncEventEmitter.js";
import debugUtil from "debug";

import EventEmitter from "./Util/AsyncEventEmitter.js";

const debug = debugUtil("Eleventy:EventBus");

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GlobalDependencyMap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { fileURLToPath } from "node:url";

import { DepGraph } from "dependency-graph";
import { TemplatePath } from "@11ty/eleventy-utils";
import debugUtil from "debug";
import { fileURLToPath } from "url";

import PathNormalizer from "./Util/PathNormalizer.js";

Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/RenderPlugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promises as fsp, default as fs } from "fs";
import { promises as fsp, default as fs } from "node:fs";
import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils";

// TODO add a first-class Markdown component to expose this using Markdown-only syntax (will need to be synchronous for markdown-it)
Expand Down
7 changes: 4 additions & 3 deletions src/Template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import util from "node:util";
import os from "node:os";
import path from "node:path";

import fs from "graceful-fs";
import util from "util";
import os from "os";
import path from "path";
import normalize from "normalize-path";
import lodash from "@11ty/lodash-custom";
import { DateTime } from "luxon";
Expand Down
2 changes: 1 addition & 1 deletion src/TemplateConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "fs";
import fs from "node:fs";
import chalk from "kleur";
import { TemplatePath } from "@11ty/eleventy-utils";
import debugUtil from "debug";
Expand Down
5 changes: 3 additions & 2 deletions src/TemplateContent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os from "os";
import os from "node:os";
import util from "node:util";

import fs from "graceful-fs";
import util from "util";
import normalize from "normalize-path";
import matter from "gray-matter";
import lodash from "@11ty/lodash-custom";
Expand Down
5 changes: 3 additions & 2 deletions src/TemplateData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";

import lodash from "@11ty/lodash-custom";
import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils";
import debugUtil from "debug";
Expand Down
2 changes: 1 addition & 1 deletion src/TemplateFileSlug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import { TemplatePath } from "@11ty/eleventy-utils";

class TemplateFileSlug {
Expand Down
2 changes: 1 addition & 1 deletion src/TemplateLayoutPathResolver.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "fs";
import fs from "node:fs";
import { TemplatePath } from "@11ty/eleventy-utils";
// import debugUtil from "debug";
// const debug = debugUtil("Eleventy:TemplateLayoutPathResolver");
Expand Down
5 changes: 3 additions & 2 deletions src/TemplatePassthrough.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";

import isGlob from "is-glob";
import copy from "recursive-copy";
import { TemplatePath } from "@11ty/eleventy-utils";
Expand Down
2 changes: 1 addition & 1 deletion src/TemplatePermalink.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import normalize from "normalize-path";
import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils";

Expand Down
2 changes: 1 addition & 1 deletion src/Util/AsyncEventEmitter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EventEmitter from "events";
import EventEmitter from "node:events";

/**
* This class emits events asynchronously.
Expand Down
2 changes: 1 addition & 1 deletion src/Util/ConsoleLogger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Readable } from "node:stream";
import chalk from "kleur";
import { Readable } from "stream";
import debugUtil from "debug";

const debug = debugUtil("Eleventy:Logger");
Expand Down
2 changes: 1 addition & 1 deletion src/Util/DirContains.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";

// Returns true if subfolder is in parent (accepts absolute or relative paths for both)
export default function (parent, subfolder) {
Expand Down
4 changes: 2 additions & 2 deletions src/Util/ImportJsonSync.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";

import { TemplatePath } from "@11ty/eleventy-utils";
import { normalizeFilePathInEleventyPackage } from "./Require.js";

Expand Down
2 changes: 1 addition & 1 deletion src/Util/PathNormalizer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";

class PathNormalizer {
static normalizeSeperator(inputPath) {
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PathPrefixer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";

import PathNormalizer from "./PathNormalizer.js";

Expand Down
10 changes: 4 additions & 6 deletions src/Util/Require.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { createRequire } from "node:module";

// https://nodejs.org/api/url.html#urlpathtofileurlpath
// import { pathToFileURL } from "url"; // node:url
import { TemplatePath } from "@11ty/eleventy-utils";
import { createRequire } from "module";

import eventBus from "../EventBus.js";

Expand Down

0 comments on commit 5277d55

Please sign in to comment.