You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm submitting a ...
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
jsonPathUtils.js has mixed import/require which seems to confuse some js compilers. Specifically vite. When I run my app which includes a library which includes PEX I end up with a require() call in the bundled javascript. When I build the library that includes PEX using esbuild I end up with the correct bundled output.
It seems like vite/rollup.js isn't able to handle the mixed import/require. There is an older bug noting this issue rollup/rollup-plugin-commonjs#273 wherein the rollup authors essentially say "don't do that then please".
Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
This should be able to be fixable via a diff like so:
@@ -1,10 +1,15 @@
import { JSONPath as jp } from '@astronautlabs/jsonpath';
import { PresentationDefinitionV1, PresentationDefinitionV2 } from '@sphereon/pex-models';
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
+// @ts-ignore @eslint-ignore
+import shim from 'string.prototype.matchall';
import { InputFieldType, IPresentationDefinition, PathComponent } from '../types';
I'm submitting a ...
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
jsonPathUtils.js has mixed import/require which seems to confuse some js compilers. Specifically vite. When I run my app which includes a library which includes PEX I end up with a require() call in the bundled javascript. When I build the library that includes PEX using esbuild I end up with the correct bundled output.
It seems like vite/rollup.js isn't able to handle the mixed import/require. There is an older bug noting this issue rollup/rollup-plugin-commonjs#273 wherein the rollup authors essentially say "don't do that then please".
This should be able to be fixable via a diff like so:
@@ -1,10 +1,15 @@
import { JSONPath as jp } from '@astronautlabs/jsonpath';
import { PresentationDefinitionV1, PresentationDefinitionV2 } from '@sphereon/pex-models';
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
+// @ts-ignore @eslint-ignore
+import shim from 'string.prototype.matchall';
import { InputFieldType, IPresentationDefinition, PathComponent } from '../types';
+shim();
+
+
export class JsonPathUtils {
static matchAll = require('string.prototype.matchall');
static REGEX_PATH = /@\w+/g;
/**
@@ -114,7 +119,7 @@ export class JsonPathUtils {
}
private static modifyPathWithSpecialCharacter(path: string): string {
const matches = this.matchAll(path, this.REGEX_PATH);
path = this.modifyPathRecursive(matches, path);
return path;
}
@@ -132,7 +137,7 @@ export class JsonPathUtils {
if (path.substring(atIdx - 2, atIdx) === '..') {
path = path.substring(0, atIdx - 2) + "..['" + next.value[0] + "']" + path.substring(atIdx + next.value[0].length);
indexChanged = true;
The text was updated successfully, but these errors were encountered: