Skip to content

Commit

Permalink
fix(providence-analytics): allow compatibility with node 16
Browse files Browse the repository at this point in the history
  • Loading branch information
tlouisse committed Mar 27, 2024
1 parent 20e5703 commit 3737c49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-badgers-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'providence-analytics': patch
---

fix: allow compatibility with node 16
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
import { isBuiltin } from 'module';
import { builtinModules } from 'module';
import path from 'path';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { LogService } from '../core/LogService.js';
import { memoize } from './memoize.js';
import { toPosixPath } from './to-posix-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
*/
import { isRelativeSourcePath } from './relative-source-path.js';

/**
* @typedef {import('../../../types/index.js').PathRelativeFromProjectRoot} PathRelativeFromProjectRoot
* @typedef {import('../../../types/index.js').PathFromSystemRoot} PathFromSystemRoot
* @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 = {
meta: {
// rollupVersion needed in plugin context => nodeResolvePackageJson.peerDependencies.rollup
Expand Down

0 comments on commit 3737c49

Please sign in to comment.