fix(providence-analytics): allow compatibility with node 16
This commit is contained in:
parent
20e5703523
commit
3737c492cc
2 changed files with 21 additions and 6 deletions
5
.changeset/fuzzy-badgers-glow.md
Normal file
5
.changeset/fuzzy-badgers-glow.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'providence-analytics': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: allow compatibility with node 16
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
import { isBuiltin } from 'module';
|
import { builtinModules } from 'module';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||||
import { LogService } from '../core/LogService.js';
|
import { LogService } from '../core/LogService.js';
|
||||||
import { memoize } from './memoize.js';
|
import { memoize } from './memoize.js';
|
||||||
import { toPosixPath } from './to-posix-path.js';
|
import { toPosixPath } from './to-posix-path.js';
|
||||||
|
import { isRelativeSourcePath } from './relative-source-path.js';
|
||||||
/**
|
|
||||||
* Solution inspired by es-dev-server:
|
|
||||||
* https://github.com/open-wc/open-wc/blob/master/packages/es-dev-server/src/utils/resolve-module-imports.js
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import('../../../types/index.js').PathRelativeFromProjectRoot} PathRelativeFromProjectRoot
|
* @typedef {import('../../../types/index.js').PathRelativeFromProjectRoot} PathRelativeFromProjectRoot
|
||||||
|
|
@ -16,6 +12,20 @@ import { toPosixPath } from './to-posix-path.js';
|
||||||
* @typedef {import('../../../types/index.js').SpecifierSource} SpecifierSource
|
* @typedef {import('../../../types/index.js').SpecifierSource} SpecifierSource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} importee
|
||||||
|
*/
|
||||||
|
function isBuiltin(importee) {
|
||||||
|
return (
|
||||||
|
!isRelativeSourcePath(importee) &&
|
||||||
|
Boolean(builtinModules.find(m => importee.split('/')[0] === m))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Solution inspired by es-dev-server:
|
||||||
|
* https://github.com/open-wc/open-wc/blob/master/packages/es-dev-server/src/utils/resolve-module-imports.js
|
||||||
|
*/
|
||||||
const fakePluginContext = {
|
const fakePluginContext = {
|
||||||
meta: {
|
meta: {
|
||||||
// rollupVersion needed in plugin context => nodeResolvePackageJson.peerDependencies.rollup
|
// rollupVersion needed in plugin context => nodeResolvePackageJson.peerDependencies.rollup
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue