From a2e121d55e130e8a1282d90dca34a94794d2bda7 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Fri, 31 Dec 2021 13:33:25 +0000 Subject: [PATCH 1/2] chore: drop import-cwd --- package.json | 1 - src/options.js | 4 +++- src/plugins.js | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e325824..6d56c37 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "url": "https://opencollective.com/postcss/" }, "dependencies": { - "import-cwd": "^3.0.0", "lilconfig": "^2.0.3", "yaml": "^1.10.2" }, diff --git a/src/options.js b/src/options.js index 552d09b..ce72202 100644 --- a/src/options.js +++ b/src/options.js @@ -1,6 +1,8 @@ 'use strict' -const req = require('import-cwd') +const { createRequire } = require('module') +const path = require('path') +const req = createRequire(path.resolve(process.cwd(), '_')) /** * Load Options diff --git a/src/plugins.js b/src/plugins.js index 9b757b3..a0e9329 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -1,6 +1,8 @@ 'use strict' -const req = require('import-cwd') +const { createRequire } = require('module') +const path = require('path') +const req = createRequire(path.resolve(process.cwd(), '_')) /** * Plugin Loader From e371af7627eeaba30c2eceb1d9dad8f020ac4fff Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Sat, 1 Jan 2022 13:13:48 +0000 Subject: [PATCH 2/2] node 10 support --- src/options.js | 5 +++-- src/plugins.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/options.js b/src/options.js index ce72202..84d7b9d 100644 --- a/src/options.js +++ b/src/options.js @@ -1,8 +1,9 @@ 'use strict' -const { createRequire } = require('module') +// eslint-disable-next-line node/no-deprecated-api +const { createRequire, createRequireFromPath } = require('module') const path = require('path') -const req = createRequire(path.resolve(process.cwd(), '_')) +const req = (createRequire || createRequireFromPath)(path.resolve(process.cwd(), '_')) /** * Load Options diff --git a/src/plugins.js b/src/plugins.js index a0e9329..f1ef631 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -1,8 +1,9 @@ 'use strict' -const { createRequire } = require('module') +// eslint-disable-next-line node/no-deprecated-api +const { createRequire, createRequireFromPath } = require('module') const path = require('path') -const req = createRequire(path.resolve(process.cwd(), '_')) +const req = (createRequire || createRequireFromPath)(path.resolve(process.cwd(), '_')) /** * Plugin Loader